lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael McCandless <>
Subject Re: Handling OR, NOT, AND operators in search query
Date Mon, 14 Aug 2006 10:22:23 GMT

> I am refactoring our search code that was written prior to 1.4.3.  I am 
> using Lucene 2.0 now.  The search string entered by users was actually 
> parsed by our custom code to generate the query.  This code was getting 
> fairly big and messy and I'm changing the code to use Lucene's query 
> parsers to build the query.  I am actually using the 
> MultiFieldQueryParser.  The problem I am having is the OR, NOT, and AND 
> operators are not being interpreted as operators but just as terms.  I am 
> using the WhitespaceAnalyzer and defaulting the operator to 
> QueryParser.AND_OPERATOR.  Any ideas how to get these strings to be 
> interpreted as operators?

These operators should work correctly.

One restriction is that they must be all caps, ie "x OR y" will work but 
"x or y" will treat or as a literal term.  Is this what you're hitting?

> Thanks in advance for any help you can give me on this.  I want to also 
> say that not only is Lucene a great powerful search engine but the user 
> mailing list must be one of the best!!   It so nice to see how quickly we 
> get responses on our questions.   I've also learned a lot from what others 
> write about. 

You're welcome!


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

View raw message