static FacetMethod selectFacetMethod(SchemaField field,FacetMethod method,Integer mincount){
  FieldType type=field.getType();
  if (method == null) {
    if (type instanceof BoolField && (field.indexed() == true || field.hasDocValues() == false)) {
      method=FacetMethod.ENUM;
    }
 else     if (type.getNumericType() != null && !field.multiValued()) {
      method=FacetMethod.FCS;
    }
 else {
      method=FacetMethod.FC;
    }
  }
  if (method == FacetMethod.FC && type.getNumericType() != null && !field.multiValued()) {
    method=FacetMethod.FCS;
  }
  if (method == FacetMethod.UIF && !field.hasDocValues() && mincount == 0) {
    method=field.multiValued() ? FacetMethod.FC : FacetMethod.FCS;
  }
  if (method == FacetMethod.ENUM && TrieField.getMainValuePrefix(type) != null) {
    method=field.multiValued() ? FacetMethod.FC : FacetMethod.FCS;
  }
  final boolean multiToken=field.multiValued() || type.multiValuedFieldCache();
  if (method == FacetMethod.FCS && multiToken) {
    method=FacetMethod.FC;
  }
  return method;
}

static FacetMethod selectFacetMethod ( SchemaField field , FacetMethod method , Integer mincount ) { FieldType type = field . getType ( ) ; if ( method == null ) { if ( type instanceof BoolField && ( field . indexed ( ) == true || field . hasDocValues ( ) == false ) ) { method = FacetMethod . ENUM ; } else if ( type . getNumericType ( ) != null && ! field . multiValued ( ) ) { method = FacetMethod . FCS ; } else { method = FacetMethod . FC ; } } if ( method == FacetMethod . FC && type . getNumericType ( ) != null && ! field . multiValued ( ) ) { method = FacetMethod . FCS ; } if ( method == FacetMethod . UIF && ! field . hasDocValues ( ) && mincount == 0 ) { method = field . multiValued ( ) ? FacetMethod . FC : FacetMethod . FCS ; } if ( method == FacetMethod . ENUM && TrieField . getMainValuePrefix ( type ) != null ) { method = field . multiValued ( ) ? FacetMethod . FC : FacetMethod . FCS ; } final boolean multiToken = field . multiValued ( ) || type . multiValuedFieldCache ( ) ; if ( method == FacetMethod . FCS && multiToken ) { method = FacetMethod . FC ; } return method ; }
this method will force the appropriate facet method even if the user provided a different one as a request parameter n . b . this method could overwrite what you passed as request parameter . be extra careful
