ZF-7789: Zend lucene search result will lose some records when using the index created by java lucene


When I was using zend search to search a string cross multi-fields from the index created by java lucene 1.9.1, the search result missed one record. Please follow the steps below to reproduce it.

  1. copy the index files in attachment to "C:\index"

  2. write a php script including the following code $index = Zend_Search_Lucene::open("C:\index"); $query = Zend_Search_Lucene_Search_QueryParser::parse("contents:role AND tags:abc"); $hits = $index->find($query);

  3. run it and you will see the search result count will be three. The correct count should be four.


index file created by java lucene

I have the same problem with an java created index. With luke.jar i can see the document contains words like 'behrenz'. But if i search for 'behr' with Zend, no results are found. The search for 'behre' or 'beh*' however returns the correct result.

Any ideas?

Hi Kevin,

i think i resolved the problem for Version 1.9.7 to 1.10.2: add this line:

  $docsFilter = new Zend_Search_Lucene_Index_DocsFilter();

into the file: /Search/Lucene/Search/Query/MultiTerm.php at line 531 bevore the second foreach over '$this->_terms'

Not sure but i think the $docsFilter will be changend during the call

  $termDocs = $reader->termDocs($term, $docsFilter);

in line 345

Sorry, it must be added in line 351 of the file /Search/Lucene/Search/Query/MultiTerm.php and not line 531

It seems it duplicates ZF-5545 issue

Resolved since duplicated issue is fixed