You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-dev@lucene.apache.org by Mike Anderson <mi...@MIT.EDU> on 2009/09/10 19:13:46 UTC

BooleanQuery constructor

I have a string that represents a boolean query (because I passed it  
in as a URL parameter), is it possible to instantiate a BooleanQuery  
object that represents this query?

I think what I am looking for is something like a BooleanQuery  
constructor that takes in a string, but this doesn't exist. The other  
option would be to create a new empty Boolean Query and then  
deconstruct the string and populate my new BQ, but i'm not sure how to  
deconstruct the string in this way.

Any help would be appreciated.

-mike


Re: BooleanQuery constructor

Posted by Shalin Shekhar Mangar <sh...@gmail.com>.
On Thu, Sep 10, 2009 at 10:43 PM, Mike Anderson <mi...@mit.edu> wrote:

> I have a string that represents a boolean query (because I passed it in as
> a URL parameter), is it possible to instantiate a BooleanQuery object that
> represents this query?
>
> I think what I am looking for is something like a BooleanQuery constructor
> that takes in a string, but this doesn't exist. The other option would be to
> create a new empty Boolean Query and then deconstruct the string and
> populate my new BQ, but i'm not sure how to deconstruct the string in this
> way.
>
>
A Query object is independent of the string representation. Look at Lucene's
org.apache.lucene.queryParser.QueryParser#parse(String)

-- 
Regards,
Shalin Shekhar Mangar.