We use antlr, though without its tree api, it's a bit of overkill. It directly builds a query in our intermediate format which is traversed for synonym/phrase detection and converted to lucene query.
The library/language itself is pretty easy to learn, flexible, and has a nice IDE. On Fri, Sep 25, 2009 at 19:17, Peter Keegan <peterlkee...@gmail.com> wrote: > We're using Antlr for our query parsing. What I like about it: > - flexibility of separate lexer/parser and tree api > - excellent IDE for building/testing the grammar > However, the learning curve was quite long for me, although this was my > first real encounter with parsers. > > Peter > > On Fri, Sep 25, 2009 at 9:58 AM, Grant Ingersoll <gsing...@apache.org> > wrote: >> >> Has anyone looked/used Antlr for Query Parser capabilities? There was >> some discussion over at Apache Labs that might bear discussing in light of >> our new Query Parser contrib. >> >> Begin forwarded message: >> >> From: Tim Williams <william...@gmail.com> >> Date: August 17, 2009 8:09:04 PM EDT >> To: l...@labs.apache.org >> Subject: Re: Lab - Esqueranto >> Reply-To: l...@labs.apache.org >> >> On Mon, Aug 17, 2009 at 7:00 PM, Grant Ingersoll<gsing...@apache.org> >> wrote: >> >> On Aug 2, 2009, at 1:43 PM, Tim Williams wrote: >> >> Hi Martin, >> >> Sure, if it works like I envision it, Lucene would just be *one* >> >> concrete tree grammar implementation - there could be others (ie >> >> OracleText), I'm thinking it is broader than one implementation - >> >> otherwise, I reckon it's Yet Another Lucene Query Parser (YALQP). >> >> For more practical reasons, I'm not a Lucene committer and it'd be >> >> slow going to play around with this through JIRA patches to their >> >> sandbox. >> >> FWIW, Lucene has recently added a new, more flexible Query Parser that >> >> allows for separation of the various pieces (syntax, intermediate >> >> representation, Lucene Query). You might want to check it out and see how >> >> that fits >> >> Thanks Grant, yeah I've looked at that and it seems really (overly?) >> complex for what I'm trying to achieve. It seems to re-implement much >> of the goodness that antlr provides for free. For example, with antlr >> I already get a lexer/parser grammar separate from the tree grammar. >> So, to plug in a new parser syntax is trivial - just implement a new >> lexer/parser grammar that provides tree rewrites consistent with a >> lucene tree grammar. Conversely, to implement a new concrete >> implementation, just implement a new tree grammar for the existing >> lexer/parser grammar. >> >> Of course, maybe I'll get down this road and realize how naive my path >> is and just switch over. For now, just looking at a query parser >> that, by itself, is approaching the size of the lucene core code base >> is intimidating:) Thanks for the pointer though, I'm subscribed over >> there and keep an eye out for progress on the new parser.... >> >> Thanks, >> --tim >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: labs-unsubscr...@labs.apache.org >> For additional commands, e-mail: labs-h...@labs.apache.org >> >> >> > > -- Kirill Zakharenko/Кирилл Захаренко (ear...@gmail.com) Home / Mobile: +7 (495) 683-567-4 / +7 (903) 5-888-423 ICQ: 104465785 --------------------------------------------------------------------- To unsubscribe, e-mail: java-dev-unsubscr...@lucene.apache.org For additional commands, e-mail: java-dev-h...@lucene.apache.org