--- 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.