/** * @param $data * @param SearchIndexInterface $index * * @return IndexInterface */ public function unindex($data, SearchIndexInterface $index) { $hits = $index->find('group_id:' . $data->id); foreach ($hits as $hit) { $index->delete($hit->id); } return $this; }
/** * Delete index for the current exam entity * * @param \ZendSearch\Lucene\SearchIndexInterface $indexer */ public function deleteIndex($indexer) { $hits = $indexer->find('pk:' . $this->getId()); // there should be only one, but just in case foreach ($hits as $hit) { $indexer->delete($hit); } $indexer->commit(); }
public function find($query) { return $this->index->find($query); }