Say we have a Lucene index that has several documents indexed using StopAnalyzer.ENGLISH_STOP_WORDS_SET . The user issues two requests:
Suppose the first query yields some results because there are documents matching this query.
The second query yields 0 results. The reason for this is that when analyzing baz:"there is" it ends as a void request, since there are and are temporary words (from a technical point of view, this is converted to an empty BooleanQuery without sentences). So far so good.
However, any of the following combined queries
+foo:bar +baz:"there is"foo:bar AND baz:"there is"
behaves exactly the same as the query +foo:bar , that is, it returns some results - all, despite the second part of AND , which does not produce results.
It can be argued that with ANDing both conditions must be met, but they are not.
It seems controversial because the atomic query component has a different effect on the overall query depending on the context. Is there a logical explanation for this? Can this be solved in any way, preferably without writing your own QueryAnalyzer ? Could this be classified as a Lucene bug?
If that matters, the observed behavior occurs in Lucene v3.0.2.
This question was also posted on the Lucene Java user mailing list , there have been no answers yet.
source share