Reputation: 13110
A Lucene query of the form
field1:+"term1" field2:+"term2"
seems to be equivalent to
field1:"term1" OR field2:"term2"
I expected it to be equivalent to
field1:"term1" AND field2:"term2"
(i.e for my particular query on my database query 1 and 2 are returning 10 records, whereas query 3 is returning 6 records, I would expect query 2 to only return six records)
Im aware that if there is no OR or AND it defaults to OR but I thought the + means that term has to match, otherwise what is the point of the + What am i misunderstanding ?
Upvotes: 3
Views: 85
Reputation: 33341
That query doesn't look equivalent to either of those, to me.
field1:+"term1" field2:+"term2"
Is just invalid syntax, and the standard QueryParser does kick out a ParseException
for it (maybe your code is swallowing the exception silently or something?).
It should be:
+field1:"term1" +field2:"term2"
Upvotes: 2