lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Erick Erickson" <>
Subject Re: Building queries
Date Thu, 18 May 2006 17:02:14 GMT
One last small note based upon my experience (I warned you I didn't have
much, didn't I?)... use the parser if you can. The last thing I wanted to do
was spend a lot of development time working out all the scenarios....... For
instance, if you're building up your clause manually, how sure are you that
you parse the following correctly?

term1 and (term2 or "this is a phrase") not (term3 or (term4 and term5))

Yes, it's a simple tree structure. Yes, there are well-defined algorithms
for it. I don't care. The work has already been done and is already packaged
up in the jar <G>.....

What I wound up doing was subclassing QueryParser, overriding the methods
there that I cared about (in my case, I wanted to handle wildcards with a
filter). That way, I got all the messy handling of parsing the and/or/not
and grouping and got to deal with my particular issues without spending time
reinventing the wheel....

None of which matters if you don't allow the user to enter their own boolean


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message