Not much luck so far :( Just in case if anyone wants to earn some virtual dosh, I have added some 50 bonus points to this question on StackOverflow:
http://stackoverflow.com/questions/6044061/lucene-query-parsing-behaviour-joining-query-parts-with-and I also promise to post a solution here if anything satisfactory turns up. m. 2011/5/17 Mindaugas Žakšauskas <min...@gmail.com>: > Hi, > > Let's say we have an index having few documents indexed using > StopAnalyzer.ENGLISH_STOP_WORDS_SET. The user issues two queries: > 1) foo:bar > 2) baz:"there is" > > Let's assume that the first query yields some results because there > are documents matching that query. > > The second query contains two stopwords ("there" and "is") and yields > 0 results. The reason for this is because when baz:"there is" is > parsed, it ends up as a void query as both "there" and "is" are > stopwords (technically speaking, this is converted to an empty > BooleanQuery having no clauses). So far so good. > > However, any of the following combined queries > > +foo:bar +baz:"there is" > foo:bar AND baz:"there is" > > behave exactly the same way as query +foo:bar, that is, brings back > some results. The second AND part which is supposed to yield no > results is completely ignored. > > One might argue that when ANDing both conditions have to be met, that > is, documents having foo=bar and baz being empty have to be retrieved, > as when issued seperately, baz:"there is" yields 0 results. > > It seem contradictory as an atomic query component has different > impact on the overall query depending on the context. Is there any > logical explanation for this? Can this be addressed in any way, > preferably without writing own QueryAnalyzer? > > If this makes any difference, observed behaviour happens under Lucene v3.0.2. > > Regards, > Mindaugas > --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org