lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wburzyns <>
Subject PrecedenceQueryParser vs. QueryParser discrepancy
Date Sun, 04 Mar 2012 20:40:21 GMT
Hi devs,

There is a discrepancy in parsing behavior between PrecedenceQueryParser 
and QueryParser if the query is both single term and negative-only, e.g. 

In this case with QueryParser the returned Query object is instanceof 
BooleanQuery whereas with PrecedenceQueryParser it's of TermQuery 
instance. This is inconvenient since with the parsed query which is an 
instance of BooleanQuery class it's easy to check if the user-supplied 
query is negative only. This is not possible with TermQuery. This also 
means that the PrecedenceQueryParser parses "-exchange:nasdaq" to 
"+exchange:nasdaq". What's interesting, there is no such problem with 
negative-only queries consisting of at least two terms.

Is the above behavior a "feature" of the contrib parser or a bug?

Wojtek Burzynski

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message