lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan Høydahl / Cominvent <jan....@cominvent.com>
Subject Re: SolrJ: Setting multiple parameters
Date Sun, 20 Jun 2010 21:48:55 GMT
Or simply use add(), because setParam overrides existing hashMap key:

   solrQuery.setParam("stats.facet", "fieldA");
   solrQuery.add("stats.facet", "fieldB");
   solrQuery.add("stats.facet", "fieldC");

--
Jan Høydahl, search solution architect
Cominvent AS - www.cominvent.com
Training in Europe - www.solrtraining.com

On 20. juni 2010, at 21.17, Chris Hostetter wrote:

> 
> : *    solrQuery.setParam("stats.facet", "fieldA");
> :     solrQuery.setParam("stats.facet", "fieldB");
> :     solrQuery.setParam("stats.facet", "fieldC");*
> : 
> : But when I try to retrieve the "sum" values, it seems as if only the LAST
> : setParam I called on "stats.facet" is taking. So in this case I can get the
> : sum for fieldC, but not the other two:
> 
> It's a vararg method...
> 	setParam(String name, String... values) 
> 
> ...so use...
> 
>  solrQuery.setParam("stats.facet", "fieldA", "fieldB", "fieldC");
> 
> ...or if your list of fields is being dynamicly generated...
> 
>  String[] fieldsForStatFaceting = getStatsFacetFields();
>  solrQuery.setParam("stats.facet", fieldsForStatFaceting);
> 
> 
> 
> -Hoss
> 


Mime
View raw message