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.

        Erik


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to