lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <>
Subject Re: all stop words in exact phrase get 0 hits
Date Thu, 15 Dec 2005 15:38:36 GMT

On Dec 15, 2005, at 10:34 AM, javier muguruza wrote:

> thanks all,
> Yes, I know + means it must be true, but the phrase goes through the
> same analyzer, so stop words are removed....
> I made some debugging and I got this:
> Query query = QueryParser.parse(searchexp, "body",  
> LuceneHelper.getAnalyzer());
> If searchexp is
> ((+(body:"I have")) OR (+(attachments:"I have")))
> query .toString() is
> (+()) (+())
> but if searchexp is
> +body:"I have" OR +attachments:"I have"
> query .toString() is blank
> so that makes it work differently I think. I have lots of parenthesis
> cause I build the string by code from multiple UI boxes etc, to make
> sure ands and ors are properly handled.

If you're building up a Query from a UI, I strongly recommend you do  
so using the API rather than QueryParser.  Pieces of the expression  
may make sense to be parsed, or just analyzed of course, but  
QueryParser adds complexity to the equation.  Using BooleanQuery with  
nested PhraseQuery's and such directly will provide a much cleaner  
Query and much less trouble.


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

View raw message