lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jonathan Rochkind <>
Subject Re: Obtaining query AST?
Date Tue, 31 May 2011 19:25:59 GMT
You're going to have to parse it yourself.  Or, since Solr is open 
source, you can take pieces of the existing query parsers (dismax or 
lucene), and repurpose them. But I don't _think_ (I could be wrong) 
there is any public API in Solr/SolrJ that will give you an AST.

On 5/31/2011 3:18 PM, wrote:
> Hi, thanks for the tip. I noticed the XML stuff, but the trouble is I am
> taking a query string entered by a user such as "this OR that AND (this
> AND that)" so I'm not sure how to go from that to a representational AST
> parse tree...
>> I believe there is a query parser that accepts queries formatted in XML,
>> allowing you to provide a parse tree to Solr; perhaps that would get you
>> the control you're after.
>> -Mike
>> On 05/31/2011 02:24 PM, wrote:
>>> Hi,
>>>    I want to write my own query expander. It needs to obtain the AST
>>> (abstract syntax tree) of an already parsed query string, navigate to
>>> certain parts of it (words) and make logical phrases of those words by
>>> adding to the AST - where necessary.
>>> This cannot be done to the string because the query logic cannot be
>>> semantically altered. (e.g. AND, OR, paren's etc) so it must be parsed
>>> first.
>>> How can this be done with SolrJ?
>>> thanks for any tips.
>>> Darren

View raw message