From 1a365e77dfb8825136626202b1df462731b42060 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sun, 16 Aug 2015 08:22:05 +0200 Subject: Update to MediaWiki 1.25.2 --- .../test/lib/Elastica/Test/Query/HighlightTest.php | 49 ++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 vendor/ruflin/elastica/test/lib/Elastica/Test/Query/HighlightTest.php (limited to 'vendor/ruflin/elastica/test/lib/Elastica/Test/Query/HighlightTest.php') diff --git a/vendor/ruflin/elastica/test/lib/Elastica/Test/Query/HighlightTest.php b/vendor/ruflin/elastica/test/lib/Elastica/Test/Query/HighlightTest.php new file mode 100644 index 00000000..4b1b6c5e --- /dev/null +++ b/vendor/ruflin/elastica/test/lib/Elastica/Test/Query/HighlightTest.php @@ -0,0 +1,49 @@ +_getClient(); + $index = $client->getIndex('test'); + $index->create(array(), true); + $type = $index->getType('helloworld'); + + $phrase = 'My name is ruflin'; + + $doc = new Document(1, array('id' => 1, 'phrase' => $phrase, 'username' => 'hanswurst', 'test' => array('2', '3', '5'))); + $type->addDocument($doc); + $doc = new Document(2, array('id' => 2, 'phrase' => $phrase, 'username' => 'peter', 'test' => array('2', '3', '5'))); + $type->addDocument($doc); + + $queryString = new QueryString('rufl*'); + $query = new Query($queryString); + $query->setHighlight(array( + 'pre_tags' => array(''), + 'post_tags' => array(''), + 'fields' => array( + 'phrase' => array( + 'fragment_size' => 200, + 'number_of_fragments' => 1, + ), + ), + )); + + $index->refresh(); + + $resultSet = $type->search($query); + foreach ($resultSet as $result) { + $highlight = $result->getHighlights(); + $this->assertEquals(array('phrase' => array(0 => 'My name is ruflin')), $highlight); + } + $this->assertEquals(2, $resultSet->count()); + + } +} -- cgit v1.2.3-54-g00ecf