I am trying to delete a document using zend lucene. The following is my code
$index = Zend_Search_Lucene::open('data/index');
foreach ($index->find('pk:' . $this->getId()) as $hit) {
$index->delete($hit->id);
}
$index->commit();
When I run this and checked my index folder there is a new file created like this _f4t5_1.del
But when I do a search, the deleted document is available in the search and also checked the
$index->numDocs();
This method also returns the same count before and after delete.
Any help is appreciated.
Just found the issue. The issue was due to a logical error in my code. After deleting I was calling another function which again added the document to the index. When I checked the document ID if found it to be different after deleting and that helped me to track the issue. Thanks for the help