|
[
Permlink
| « Hide
]
steve halsey added a comment - 06/Jun/08 05:47 PM
This test fails, demonstrating the existence of the negative wildcard query on MultiSearchers bug.
This test class shows the test working with the old 1.5.1 version of lucene, modified to make it work with that old API.
Great catch Steve. The combine method in Query appears to be very flawed when it comes to MUST_NOT occurrences and truncation queries. Nasty little bug that does indeed appear to go back to 05. Thanks for all of the detailed info. I am sure someone will be right on top of this.
Looks like the test worked before because things were even (it would appear) worse - the bug was that the multi term query was only expanded on the first index and then the resulting query was used on all of the indexes. The issue introducing the bug you have found was an attempt to fix this by expanding on each Reader and then attempting to make a single query that works across each Reader. The strategy seems to work in non MUST_NOT cases, but the query generated can just be wrong with a MUST_NOT occurrence. As you point out, the second index doesn't even have to be empty, and the second -() clause does not even have to be empty either - the generated query can still be wrong.
I don't see the obvious fix - somehow we need a query that expands against all of the subreaders as if one reader, or the combine method has to figure this out...neither seem easy to me... One option may be to do this:
Figure out how we can change Searchable (deprecation, whatever) and add a getIndexReader method. Make the getIndexReader method on MultiSearcher return a MultiReader with the underlying searchable Readers. Now on MultiSearcher rewrite, the query can be rewritten on a temp IndexSearcher that uses the MultiReader. Ive tried it quickly, but I havn't thought out all the ramifications. I wouldnt be surprised if there was some biggies (being able to get an IndexReader off a Searchable would be quite the change)...and obviously changing Searchable pretty much sucks. Any other ideas though? I can't think of a way to make the combine method work right otherwise without recursing down the query and doing some really nasty bookkeeping stuff. Okay, I clearly underestimated the difficulties of this due to RemoteSearchable. I don't see how it can be done in any efficient manner when you have to work off a Searchable, and obviously you can't do anything with multiple Readers using the MultiSearcher on the client side, so it would seem making the Query.combine method work is the only option...except that doing such a thing would be really nasty I think.
This is actually a dupe of an older issue.
There is no clean way to fix it with the current Searchable API. Avoid MultiSearcher if you can <g> Hi Mark,
OK. Thanks for that. It is a rarely seen problem, because most times Cheers steve |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||