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());
 }
 /**
  * @group functional
  */
 public function testSetMinimumShouldMatchWorks()
 {
     $index = $this->_createIndex();
     $type = $index->getType('foobars');
     $type->addDocuments(array(new Document(1, array('body' => 'foo')), new Document(2, array('body' => 'bar')), new Document(3, array('body' => 'foo bar')), new Document(4, array('body' => 'foo baz bar'))));
     $index->refresh();
     $query = new SimpleQueryString('foo bar');
     $query->setMinimumShouldMatch(2);
     $results = $type->search($query);
     $this->assertCount(2, $results);
     $this->assertEquals(3, $results[0]->getId());
     $this->assertEquals(4, $results[1]->getId());
 }