I have already read this question Creating and updating Zend_Search_Lucene indexes.
But it has failed to answer to my problem. This article from zend, tells that updating the document is not possible. To update effectively, every document have to be deleted and re indexed.
$removePath = ...;
$hits = $index->find('path:' . $removePath);
foreach ($hits as $hit) {
$index->delete($hit->id);
}
Now, this does not work for me. I gave the index Path in the $removePath
and tried the code. It didn't work. If I use something relative to my particular index such as $index->find("title:test");
it throws
Fatal error: Exception thrown without a stack frame in Unknown on line 0
I also tried using
$query = new Zend_Search_Lucene_Search_Query_Term(new Zend_Search_Lucene_Index_Term('test', 'title'));
$hits = $this -> index->find($query);
But it gave same result.
I do not even know how to debug that type of error. And even it gets debugged, I will only get the searched items rather than all the documents. So, all documents are not deleted.
Can anyone, tell me what am i doing wrong. How to update your search indexes?