lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ahmet Arslan <iori...@yahoo.com>
Subject RE: SolJ and query parameters
Date Thu, 07 Jan 2010 18:08:03 GMT
> 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)}

No. setFields is equvalent to  &fl=title,description  It determines which fields will
be returned as a result.

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

SolrQuery extends ModifiableSolrParams. If you look at the source code of it you can understand.
For example setQuery method invokes this.set(CommonParams.Q, query);

You can set anything in the search url with this class. &key=value is equal to SolrQuery.set(key,
value). There are some multivalued keys like fq and facet.field, in those cases you can use
add() method.


      

Mime
View raw message