Lucene unexpectedly gives different results when operator of search words changes

Posted by Lars Andren on Stack Overflow See other posts from Stack Overflow or by Lars Andren
Published on 2010-06-10T06:38:09Z Indexed on 2010/06/10 6:42 UTC
Read the original article Hit count: 164

I am using Lucene with Java. In the index I have a single document with a single name:value-field

text:alabama oklahoma

When I search for

+alabama -oklahoma

it returns no results, as expected. However, when I search for

-alabama +oklahoma

it returns the single document as a match to the query.

Has anyone else noticed this behaviour? Any ideas on why this happens?

© Stack Overflow or respective owner

Related posts about java

Related posts about lucene