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"
(ie 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 ?
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"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.