Example #1
0
 /**
  * @group functional
  */
 public function testSetCache()
 {
     $client = $this->_getClient();
     $index = $client->getIndex('test');
     $index->create(array(), true);
     $type = $index->getType('test');
     $type->addDocuments(array(new Document(1, array('name' => 'hello world')), new Document(2, array('name' => 'nicolas ruflin')), new Document(3, array('name' => 'ruflin'))));
     $and = new BoolAnd();
     $idsFilter1 = new Ids();
     $idsFilter1->setIds(1);
     $idsFilter2 = new Ids();
     $idsFilter2->setIds(1);
     $and->addFilter($idsFilter1);
     $and->addFilter($idsFilter2);
     $index->refresh();
     $and->setCached(true);
     $resultSet = $type->search($and);
     $this->assertEquals(1, $resultSet->count());
 }