Ejemplo n.º 1
0
 function testTemporaryFields()
 {
     $contentSource = new Search_ContentSource_Static(array('HomePage' => array('_title' => 'Hello')), array('_title' => 'plaintext'));
     $index = new Search_Index_Memory();
     $indexer = new Search_Indexer($index);
     $indexer->addContentSource('wiki page', $contentSource);
     $stats = $indexer->rebuild();
     $document = $index->getDocument(0);
     $typeFactory = $index->getTypeFactory();
     $this->assertArrayNotHasKey('_title', $document);
 }
Ejemplo n.º 2
0
 function testContentSourceWithMultipleResults()
 {
     $contentSource = new Search_ContentSource_Static(array('HomePage' => array(array('title' => 'Hello'), array('title' => 'Hello (latest)'))), array('title' => 'plaintext'));
     $index = new Search_Index_Memory();
     $indexer = new Search_Indexer($index);
     $indexer->addContentSource('wiki page', $contentSource);
     $stats = $indexer->rebuild();
     $document = $index->getDocument(1);
     $typeFactory = $index->getTypeFactory();
     $this->assertEquals($typeFactory->plaintext('Hello (latest)'), $document['title']);
     $this->assertEquals(array('wiki page' => 2), $stats);
 }