Thanks for the reply. 

Using SolrQuery.setQuery("{!lucene q.op=AND df=text}myfield:foo +bar -baz}"); 
would make more sense if it were not for the other methods available on 
SolrQuery. 

For example, there is a "setFields(String..)" method. So what happens if I call 
setFields("title", "description") after having set the query to the above 
value? What do I end up with? Something like this:

{!lucene q.op=AND df=text}title:(foo +bar -baz) description:(foo +bar baz)}

I'm still having trouble understanding how the class is intended to be used. 

Cheers

Jon


-----Original Message-----
From: Ahmet Arslan [mailto:iori...@yahoo.com] 
Sent: 07 January 2010 17:38
To: solr-user@lucene.apache.org
Subject: Re: SolJ and query parameters



--- On Thu, 1/7/10, Jon Poulton <jon.poul...@vyre.com> wrote:

> From: Jon Poulton <jon.poul...@vyre.com>
> Subject: SolJ and query parameters
> To: "'solr-user@lucene.apache.org'" <solr-user@lucene.apache.org>
> Date: Thursday, January 7, 2010, 7:25 PM
> Hi there,
> I'm trying to understand how the query syntax specified on
> the Solr Wiki ( http://wiki.apache.org/solr/SolrQuerySyntax ) fits in
> with the usage of the SolJ class SolrQuery. There are not
> too many examples of usage to be found.
> 
> For example. Say I wanted to replicate the following query
> using SolrQuery.
> 
> q={!lucene q.op=AND df=text}myfield:foo +bar -baz

Whole string is the value of the parameter q.

SolrQuery.setQuery("{!lucene q.op=AND df=text}myfield:foo +bar -baz");

> How would I do it so that q.op was set to "OR" instead of
> "AND"? There is no method I can see on SolrQuery to set
> q.op, only a "query string", which is presumably in this
> case is the text "+bar -baz", as the rest can be specified
> by calling set methods on SolrQuery.

if you want to set q.op to AND you can use SolrQuery.set(QueryParsing.OP,"AND");

hope this helps.


      

Reply via email to