mirror of https://github.com/apache/lucene.git
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:
parent
5122ececbb
commit
9d7995d57c
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue