magentozend-search-lucene

Magento Lucene Search Exception - Wrong segments.gen file format


A Magento installation hit 100% disk usage. After rectifying this issue, it seems that Lucene search is now offline.

I'm not able to rebuild the search index as I am simply presented with this error:

[ssh]$ php shell/lucene-tool.php --removeall 1                                                                                                                                                                                                                              
Removing all documents from the index...(can be slow)                                                                                                                                                                                                                                                 
PHP Fatal error:  Uncaught exception 'Zend_Search_Lucene_Exception' with message 'Wrong segments.gen file format' in /html/lib/Zend/Search/Lucene.php:266                                                                                                         
Stack trace:                                                                                                                                                                                                                                                                                          
0 /html/lib/Zend/Search/Lucene.php(529): Zend_Search_Lucene::getActualGeneration(Object(Zend_Search_Lucene_Storage_Directory_Filesystem))                                                                                                                        
1 /html/lib/Zend/Search/Lucene.php(211): Zend_Search_Lucene->__construct('/html...', true)                                                                                                                                                             
2 /html/app/code/community/Php4u/BlastLuceneSearch/Model/Blastlucenesearch.php(19) : eval()'d code(1) : eval()'d code(1) : eval()'d code(18): Zend_Search_Lucene::create('/chroot/home/wo...')                                                                   
3 /html/app/code/community/Php4u/BlastLuceneSearch/Model/Blastlucenesearch.php(19) : eval()'d code(1) : eval()'d code(1) : eval()'d code(18): Php4u_BlastLuceneSearch_Model_BlastLuceneSearch->getIndex()                                                        
4 /html/shell/lucene-t in /html/lib/Zend/Search/Lucene.php on line 297    

I've sorted out the disk spage issue and run a permissions fix accross the entire server. I'm not sure which step to take next.


Solution

  • I ended up resolving the situation as follows:

    1. Delete var/indexer/
    2. Create var/indexe/ replacement folder
    3. SSH php shell/lucene-tool.php --mark_unprocessed 1
    4. SSH php shell/lucene-tool.php --removeall 1
    5. SSH php shell/indexer.php --reindex rebuild_search_index_lucene

    How to reindex all products from the scratch (SSH method) ? (Full reindex)

    This restored the search index & the error is no longer popping up.