Description

using Zend_Search_Lucene_Interface_MultiSearcher gives an error when the find function is used. The reason for this is that the find function searches through each index and increments each result document id based on its position in the combined results. Commenting out that for loop resolved in Zend/Search/Lucene/MultiSearcher.php from 467/471 fixes. Though this feature was in the 1.8 reslease is this a production ready feature? (there isn't mention of it in the documentation and the namespacing doesn't follow codiing standards.)

Comments

Posted by Deon Visagie (dcvisagie) on 2010-01-08T01:06:21.000+0000

Line 476 (ZF 1.9.6)
$indexShift += $index->count();

Should be changed to something like this:
$indexShift += count($hits);

The index id location should be incremented by the number of hits, not the complete size of the index. The above worked for me. Removing the loop might create duplicate id's if using multiple indexes in different locations.

"$indexShift += count($hits);" still wrong, but it will work if you have hits only in one of indexes.
As far as I can see id is internal id of document in index and cannot be changed in any way or you will get this error. Each hit have index link so you can retrive document from right index.
You can determine from which index this one is by comparing $hit->getIndex() withyour indexes or by adding unindexed field with type entity in all your documents. I have field "entity" to determine which kind of result is that hit.

I dont know how to add patch here (and I actually didn't patch but extend class) but there is my find function without that bug and with merging result to preserve sorting by score. It may be buggy as I just wrote it but seems working.