From 80f7dc77d430774192b929d780f96260066df2ee Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sun, 18 Oct 2015 09:31:31 +0200 Subject: Update to MediaWiki 1.25.3 --- .../test/lib/Elastica/Test/Suggest/PhraseTest.php | 85 ---------------------- 1 file changed, 85 deletions(-) delete mode 100644 vendor/ruflin/elastica/test/lib/Elastica/Test/Suggest/PhraseTest.php (limited to 'vendor/ruflin/elastica/test/lib/Elastica/Test/Suggest/PhraseTest.php') diff --git a/vendor/ruflin/elastica/test/lib/Elastica/Test/Suggest/PhraseTest.php b/vendor/ruflin/elastica/test/lib/Elastica/Test/Suggest/PhraseTest.php deleted file mode 100644 index eda08ba0..00000000 --- a/vendor/ruflin/elastica/test/lib/Elastica/Test/Suggest/PhraseTest.php +++ /dev/null @@ -1,85 +0,0 @@ -_index = $this->_createIndex('test_suggest_phrase'); - $docs = array(); - $docs[] = new Document(1, array('text' => 'Github is pretty cool')); - $docs[] = new Document(2, array('text' => 'Elasticsearch is bonsai cool')); - $docs[] = new Document(3, array('text' => 'This is a test phrase')); - $docs[] = new Document(4, array('text' => 'Another sentence for testing')); - $docs[] = new Document(5, array('text' => 'Some more words here')); - $type = $this->_index->getType(self::TEST_TYPE); - $type->addDocuments($docs); - $this->_index->refresh(); - } - - protected function tearDown() - { - $this->_index->delete(); - } - - public function testToArray() - { - $suggest = new Suggest(); - $phraseSuggest = new Phrase('suggest1', 'text'); - $phraseSuggest->setText('elasticsearch is bansai coor'); - $phraseSuggest->setAnalyzer('simple'); - $suggest->addSuggestion($phraseSuggest); - $suggest->setGlobalText('global!'); - - $expected = array( - 'suggest' => array( - 'text' => 'global!', - 'suggest1' => array( - 'text' => 'elasticsearch is bansai coor', - 'phrase' => array( - 'field' => 'text', - 'analyzer' => 'simple' - ) - ) - ) - ); - - $this->assertEquals($expected, $suggest->toArray()); - } - - public function testPhraseSuggest() - { - $suggest = new Suggest(); - $phraseSuggest = new Phrase('suggest1', 'text'); - $phraseSuggest->setText("elasticsearch is bansai coor"); - $phraseSuggest->setAnalyzer("simple")->setHighlight("", "")->setStupidBackoffSmoothing(0.4); - $phraseSuggest->addCandidateGenerator(new DirectGenerator("text")); - $suggest->addSuggestion($phraseSuggest); - - $result = $this->_index->search($suggest); - $suggests = $result->getSuggests(); - - // 3 suggestions should be returned: One in which both misspellings are corrected, and two in which only one misspelling is corrected. - $this->assertEquals(3, sizeof($suggests['suggest1'][0]['options'])); - - $this->assertEquals("elasticsearch is bonsai cool", $suggests['suggest1'][0]['options'][0]['highlighted']); - $this->assertEquals("elasticsearch is bonsai cool", $suggests['suggest1'][0]['options'][0]['text']); - } -} -- cgit v1.2.3-54-g00ecf