This is a pretty common issue that I've been grappling with by chance recently. The main point is that the parser is NOT a boolean logic parser.....
Search the mail archive for the thread "bad query parser bug" and you'll find a good discussion. I tried using PrecedenceQueryParser, but that didn't work for me very well, search the mail archive on that and you'll see some examples of why. I solved this problem for my immediate issues by writing a very quick-and-dirty parenthesizer for my raw query. If it wasn't going on summer, I might see if I can contribute something by seeing if there's a way I can see to fix PrecedenceQueryParser. Best Erick On 3/22/07, SK R <[EMAIL PROTECTED]> wrote:
Hi, Can anyone explain how lucene handles the belowed query? My query is *field1:source AND (field2:name OR field3:dest)* . I've given this string to queryparser and then searched by using searcher. It returns correct results. It's query.toString() print is :: +field1:source +(field2:name field3:dest) But if i don't group my terms (i.e) my query : *field1:source AND field2:name OR field3:dest *,then it gives the result of first two term's search result. It doesn't search 3rd term. It's query.toString() print is :: +field1:source +field2:name field3:dest. If i use same boolean operator between all terms, then it returns correct results. Why it doesn't search the terms after 2nd term if grouping not used? Thanks & Regards RSK