示例#1
0
 /**
  * We trigger index/unindex operations on postFlush events
  *
  * @param PostFlushEventArgs $ea
  */
 public function postFlush(PostFlushEventArgs $ea)
 {
     foreach ($this->scheduledIndexations as $entity) {
         $this->elastica->index($entity);
     }
     $this->scheduledIndexations = array();
     foreach ($this->scheduledUnindexations as $entity) {
         $this->elastica->indexRemove($entity);
     }
     $this->scheduledUnindexations = array();
 }
示例#2
0
 /**
  * @expectedException \UnexpectedValueException
  */
 public function testRegisterIndexerWithInvalidManagedClass()
 {
     $mockClient = $this->getMock('Leapt\\ElasticaBundle\\Client', [], [], '', false);
     $service = new Service($mockClient, 'plop');
     $service->registerIndexer('bar', new BarIndexer());
 }
 /**
  * Launch the search
  *
  */
 private function search()
 {
     $this->elasticaQuery->setLimit($this->limitPerPage);
     $this->elasticaQuery->setFrom($this->getOffset());
     $this->resultSet = $this->elastica->search($this->elasticaQuery, $this->index);
 }