diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-05-01 15:31:33 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-05-01 15:31:33 -0400 |
commit | 150f94f051128f367bc89f6b7e5f57eb2a69fc62 (patch) | |
tree | 181f454813b310ee97385058c6c6f2e3f34d5fd8 /vendor/ruflin/elastica/test/lib/Elastica/Test/Query/CommonTest.php | |
parent | 7e85254903c7c0cb49e381f16b18441ea7b058cc (diff) | |
parent | 80f7dc77d430774192b929d780f96260066df2ee (diff) |
Merge commit '80f7dc'
# Conflicts:
# extensions/ArchInterWiki.sql
Diffstat (limited to 'vendor/ruflin/elastica/test/lib/Elastica/Test/Query/CommonTest.php')
-rw-r--r-- | vendor/ruflin/elastica/test/lib/Elastica/Test/Query/CommonTest.php | 59 |
1 files changed, 0 insertions, 59 deletions
diff --git a/vendor/ruflin/elastica/test/lib/Elastica/Test/Query/CommonTest.php b/vendor/ruflin/elastica/test/lib/Elastica/Test/Query/CommonTest.php deleted file mode 100644 index a84d6397..00000000 --- a/vendor/ruflin/elastica/test/lib/Elastica/Test/Query/CommonTest.php +++ /dev/null @@ -1,59 +0,0 @@ -<?php - -namespace Elastica\Test\Query; - -use Elastica\Query\Common; -use Elastica\Test\Base as BaseTest; - -class CommonTest extends BaseTest -{ - public function testToArray() - { - $query = new Common('body', 'test query', .001); - $query->setLowFrequencyOperator(Common::OPERATOR_AND); - - $expected = array( - 'common' => array( - 'body' => array( - 'query' => 'test query', - 'cutoff_frequency' => .001, - 'low_freq_operator' => 'and' - ) - ) - ); - - $this->assertEquals($expected, $query->toArray()); - } - - public function testQuery() - { - $index = $this->_createIndex('common_test'); - $type = $index->getType('test'); - - //add documents to create common terms - $docs = array(); - for ($i = 0; $i < 20; $i++) { - $docs[] = new \Elastica\Document($i, array('body' => 'foo bar')); - } - $type->addDocuments($docs); - - $type->addDocument(new \Elastica\Document(20, array('body' => 'foo baz'))); - $type->addDocument(new \Elastica\Document(21, array('body' => 'foo bar baz'))); - $type->addDocument(new \Elastica\Document(22, array('body' => 'foo bar baz bat'))); - $index->refresh(); - - $query = new Common('body', 'foo bar baz bat', .5); - $results = $type->search($query)->getResults(); - - //documents containing only common words should not be returned - $this->assertEquals(3, sizeof($results)); - - $query->setMinimumShouldMatch(2); - $results = $type->search($query); - - //only the document containing both low frequency terms should match - $this->assertEquals(1, $results->count()); - - $index->delete(); - } -} |