Hi,

there is no need to extend Lucene's QueryParser. Lucene by itself does not need 
a Query Parser at all and it does not use it, it is just a convenience class. 
If you have worked with Antlr to generate a grammar, just use it and build the 
final org.apache.lucene.search.Query in your code. 

Uwe

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: u...@thetaphi.de


> -----Original Message-----
> From: Carsten Schnober [mailto:schno...@ids-mannheim.de]
> Sent: Monday, January 28, 2013 4:44 PM
> To: java-user
> Subject: Custom Query Syntax/Parser
> 
> Hi,
> for our project, we have to implement a custom query language that does
> have much in common with the built-in Lucene query language. We have a
> formal grammar for that language, formalized with Antlr.
> 
> I am not sure about the best way to build/generate a Lucene-based
> QueryParser object that is pluggable into our project because some of the
> query language's properties refer to information we have stored in payloads,
> i.e. require SpanQueries. Unfortunately, it is not as simple as calling a
> SpanTermQuery because we would like to allows queries for e.g. tokens that
> have the same payload, but not specified in advance.
> 
> Ideally, I would like to apply a typical Lucene query processing step as in:
> StandardQueryParser parser = new StandardQueryParser(new
> WhitespaceAnalyzer(Version.LUCENE_40));
> Query q = parser.parse("text", query);
> 
> From that point of view, the only change should be CustomParser parser =
> new CustomParser(...);
> 
> Unfortunately, I couldn't find much documentation on that. The "Lucene in
> Action" textbook refers to building custom query parsers with Antlr or
> JavaCC, but does not go into any details. The Lucene query syntax definition
> in JavaCC would probably be a valuable source, but going through that is very
> tedious. That is why I would like to know whether you might know of a
> tutorial or less complex examples.
> 
> Thank you very much!
> Carsten Schnober
> 
> --
> Institut für Deutsche Sprache | http://www.ids-mannheim.de
> Projekt KorAP                 | http://korap.ids-mannheim.de
> Tel. +49-(0)621-43740789      | schno...@ids-mannheim.de
> Korpusanalyseplattform der nächsten Generation Next Generation Corpus
> Analysis Platform
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
> For additional commands, e-mail: java-user-h...@lucene.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-user-h...@lucene.apache.org

Reply via email to