removing the setFacetMinCount() from addFacetField(). see:

http://www.nabble.com/small-bug-in-solrj--resultquery.addFacetField-overwrites-resultquery.setFacetMinCount-to-1.-tf4895967.html

Also fixing the setFields() issue

git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@599487 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Ryan McKinley 2007-11-29 15:26:04 +00:00
parent 5122ececbb
commit 9d7995d57c
1 changed files with 14 additions and 4 deletions

View File

@ -56,10 +56,11 @@ public class SolrQuery extends ModifiableSolrParams
*
* @param f the field name from the IndexSchema
*/
public void addFacetField(String f) {
this.add(FacetParams.FACET_FIELD, f);
public void addFacetField(String ... fields) {
for( String f : fields ) {
this.add(FacetParams.FACET_FIELD, f);
}
this.set(FacetParams.FACET, true);
this.setFacetMinCount(1);
}
/** get the facet fields
@ -325,7 +326,16 @@ public class SolrQuery extends ModifiableSolrParams
}
public void setFields(String ... fields) {
this.set(CommonParams.FL, fields);
if( fields == null || fields.length == 0 ) {
this.remove( CommonParams.FL );
}
StringBuilder sb = new StringBuilder();
sb.append( fields[0] );
for( int i=1; i<fields.length; i++ ) {
sb.append( ',' );
sb.append( fields[i] );
}
this.set(CommonParams.FL, sb.toString() );
}
public void addField(String field) {