lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wburzyns <wojtek.burzyn...@gmail.com>
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. 
"-exchange:nasdaq".

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?


Thanks,
Wojtek Burzynski

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message