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/SimpleQueryStringTest.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/SimpleQueryStringTest.php')
-rw-r--r-- | vendor/ruflin/elastica/test/lib/Elastica/Test/Query/SimpleQueryStringTest.php | 73 |
1 files changed, 0 insertions, 73 deletions
diff --git a/vendor/ruflin/elastica/test/lib/Elastica/Test/Query/SimpleQueryStringTest.php b/vendor/ruflin/elastica/test/lib/Elastica/Test/Query/SimpleQueryStringTest.php deleted file mode 100644 index eff9b8a1..00000000 --- a/vendor/ruflin/elastica/test/lib/Elastica/Test/Query/SimpleQueryStringTest.php +++ /dev/null @@ -1,73 +0,0 @@ -<?php - -namespace Elastica\Test\Query; - - -use Elastica\Document; -use Elastica\Index; -use Elastica\Query\SimpleQueryString; -use Elastica\Test\Base; - -class SimpleQueryStringTest extends Base -{ - /** - * @var Index - */ - protected $_index; - - protected function setUp() - { - parent::setUp(); - $this->_index = $this->_createIndex("simple_query_string_test"); - $docs = array( - new Document(1, array('make' => 'Gibson', 'model' => 'Les Paul')), - new Document(2, array('make' => 'Gibson', 'model' => 'SG Standard')), - new Document(3, array('make' => 'Gibson', 'model' => 'SG Supreme')), - new Document(4, array('make' => 'Gibson', 'model' => 'SG Faded')), - new Document(5, array('make' => 'Fender', 'model' => 'Stratocaster')) - ); - $this->_index->getType("guitars")->addDocuments($docs); - $this->_index->refresh(); - } - - protected function tearDown() - { - parent::tearDown(); - $this->_index->delete(); - } - - public function testToArray() - { - $string = "this is a test"; - $fields = array('field1', 'field2'); - $query = new SimpleQueryString($string, $fields); - $query->setDefaultOperator(SimpleQueryString::OPERATOR_OR); - $query->setAnalyzer("whitespace"); - - $expected = array( - "simple_query_string" => array( - "query" => $string, - "fields" => $fields, - "analyzer" => "whitespace", - "default_operator" => SimpleQueryString::OPERATOR_OR - ) - ); - - $this->assertEquals($expected, $query->toArray()); - } - - public function testQuery() - { - $query = new SimpleQueryString("gibson +sg +-faded", array("make", "model")); - $results = $this->_index->search($query); - - $this->assertEquals(2, $results->getTotalHits()); - - $query->setFields(array("model")); - $results = $this->_index->search($query); - - // We should not get any hits, since the "make" field was not included in the query. - $this->assertEquals(0, $results->getTotalHits()); - } -} -
\ No newline at end of file |