You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Lindsey Hess <li...@yahoo.com> on 2007/07/25 00:44:17 UTC

Query parsing?

Hi,

I'm building an application that needs to translate one query format into another.  For example, my application generates the following query from a UI:

((title="Gone With The Wind") <OR> (title="Brave New World"))

and internally I need to convert it into this format so that I can make a web service call to another application:

{//title}:Gone With The Wind OR Brave New World

Now, I do not need Lucene to index anything, but I'm wondering if Lucene has query parsing classes that will allow me to transform the queries.  If so, this will save me a lot of time from building tedious parsing logic.

Thank you.

Lindsey

       
---------------------------------
Sick sense of humor? Visit Yahoo! TV's Comedy with an Edge to see what's on, when. 

Re: Query parsing?

Posted by Daniel Naber <lu...@danielnaber.de>.
On Wednesday 25 July 2007 00:44, Lindsey Hess wrote:

> Now, I do not need Lucene to index anything, but I'm wondering if Lucene
> has query parsing classes that will allow me to transform the queries. 

The Lucene QueryParser class can parse the format descriped at 
http://lucene.apache.org/java/docs/queryparsersyntax.html. To adapt it to 
other formats, the javacc grammar needs to be modified. To output in yet 
another format, either the Java code would need to be modified or you'd 
need to write some new Java code that iterates over the object produced by 
the QueryParser. In other words: this is not what Lucene's QueryParser was 
made for and it's not too simple unless you're already familiar with 
javacc.

Regards
 Daniel

-- 
http://www.danielnaber.de

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