本文整理汇总了Java中org.apache.solr.schema.FieldType.multiValuedFieldCache方法的典型用法代码示例。如果您正苦于以下问题:Java FieldType.multiValuedFieldCache方法的具体用法?Java FieldType.multiValuedFieldCache怎么用?Java FieldType.multiValuedFieldCache使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.solr.schema.FieldType
的用法示例。
在下文中一共展示了FieldType.multiValuedFieldCache方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getStatsFields
import org.apache.solr.schema.FieldType; //导入方法依赖的package包/类
public NamedList<Object> getStatsFields() throws IOException, SyntaxError {
NamedList<Object> res = new SimpleOrderedMap<>();
String[] statsFs = params.getParams(StatsParams.STATS_FIELD);
boolean isShard = params.getBool(ShardParams.IS_SHARD, false);
if (null != statsFs) {
final IndexSchema schema = searcher.getSchema();
for (String f : statsFs) {
boolean calcDistinct = params.getFieldBool(f, StatsParams.STATS_CALC_DISTINCT, false);
parseParams(f);
String[] facets = params.getFieldParams(key, StatsParams.STATS_FACET);
if (facets == null) {
facets = new String[0]; // make sure it is something...
}
SchemaField sf = schema.getField(statsField);
FieldType ft = sf.getType();
NamedList<?> stv;
if (sf.multiValued() || ft.multiValuedFieldCache()) {
if(sf.hasDocValues()) {
stv = DocValuesStats.getCounts(searcher, sf.getName(), base, calcDistinct, facets).getStatsValues();
} else {
//use UnInvertedField for multivalued fields
UnInvertedField uif = UnInvertedField.getUnInvertedField(statsField, searcher);
stv = uif.getStats(searcher, base, calcDistinct, facets).getStatsValues();
}
} else {
stv = getFieldCacheStats(statsField, calcDistinct, facets);
}
if (isShard == true || (Long) stv.get("count") > 0) {
res.add(key, stv);
} else {
res.add(key, null);
}
}
}
return res;
}
示例2: getStatsFields
import org.apache.solr.schema.FieldType; //导入方法依赖的package包/类
public NamedList<Object> getStatsFields() throws IOException {
NamedList<Object> res = new SimpleOrderedMap<Object>();
String[] statsFs = params.getParams(StatsParams.STATS_FIELD);
boolean isShard = params.getBool(ShardParams.IS_SHARD, false);
if (null != statsFs) {
for (String f : statsFs) {
String[] facets = params.getFieldParams(f, StatsParams.STATS_FACET);
if (facets == null) {
facets = new String[0]; // make sure it is something...
}
SchemaField sf = searcher.getSchema().getField(f);
FieldType ft = sf.getType();
NamedList<?> stv;
if (sf.multiValued() || ft.multiValuedFieldCache()) {
//use UnInvertedField for multivalued fields
UnInvertedField uif = UnInvertedField.getUnInvertedField(f, searcher);
stv = uif.getStats(searcher, docs, facets).getStatsValues();
} else {
stv = getFieldCacheStats(f, facets);
}
if (isShard == true || (Long) stv.get("count") > 0) {
res.add(f, stv);
} else {
res.add(f, null);
}
}
}
return res;
}
示例3: getStatsFields
import org.apache.solr.schema.FieldType; //导入方法依赖的package包/类
public NamedList<Object> getStatsFields() throws IOException {
NamedList<Object> res = new SimpleOrderedMap<Object>();
String[] statsFs = params.getParams(StatsParams.STATS_FIELD);
boolean isShard = params.getBool(ShardParams.IS_SHARD, false);
if (null != statsFs) {
final IndexSchema schema = searcher.getSchema();
for (String f : statsFs) {
boolean calcDistinct = params.getFieldBool(f, StatsParams.STATS_CALC_DISTINCT, false);
String[] facets = params.getFieldParams(f, StatsParams.STATS_FACET);
if (facets == null) {
facets = new String[0]; // make sure it is something...
}
SchemaField sf = schema.getField(f);
FieldType ft = sf.getType();
NamedList<?> stv;
if (sf.multiValued() || ft.multiValuedFieldCache()) {
//use UnInvertedField for multivalued fields
UnInvertedField uif = UnInvertedField.getUnInvertedField(f, searcher);
stv = uif.getStats(searcher, docs, calcDistinct, facets).getStatsValues();
} else {
stv = getFieldCacheStats(f, calcDistinct, facets);
}
if (isShard == true || (Long) stv.get("count") > 0) {
res.add(f, stv);
} else {
res.add(f, null);
}
}
}
return res;
}
示例4: selectFacetMethod
import org.apache.solr.schema.FieldType; //导入方法依赖的package包/类
/**
* 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
*
* @param field field we are faceting
* @param method the facet method passed as a request parameter
* @param mincount the minimum value a facet should have to be returned
* @return the FacetMethod to use
*/
static FacetMethod selectFacetMethod(SchemaField field, FacetMethod method, Integer mincount) {
FieldType type = field.getType();
if (type.isPointField()) {
// Only FCS is supported for PointFields for now
return FacetMethod.FCS;
}
/*The user did not specify any preference*/
if (method == null) {
/* Always use filters for booleans if not DocValues only... we know the number of values is very small. */
if (type instanceof BoolField && (field.indexed() == true || field.hasDocValues() == false)) {
method = FacetMethod.ENUM;
} else if (type.getNumberType() != null && !field.multiValued()) {
/* the per-segment approach is optimal for numeric field types since there
are no global ords to merge and no need to create an expensive
top-level reader */
method = FacetMethod.FCS;
} else {
// TODO: default to per-segment or not?
method = FacetMethod.FC;
}
}
/* FC without docValues does not support single valued numeric facets */
if (method == FacetMethod.FC
&& type.getNumberType() != null && !field.multiValued()) {
method = FacetMethod.FCS;
}
/* UIF without DocValues can't deal with mincount=0, the reason is because
we create the buckets based on the values present in the result set.
So we are not going to see facet values which are not in the result set */
if (method == FacetMethod.UIF
&& !field.hasDocValues() && mincount == 0) {
method = field.multiValued() ? FacetMethod.FC : FacetMethod.FCS;
}
/* ENUM can't deal with trie fields that index several terms per value */
if (method == FacetMethod.ENUM
&& TrieField.getMainValuePrefix(type) != null) {
method = field.multiValued() ? FacetMethod.FC : FacetMethod.FCS;
}
/* FCS can't deal with multi token fields */
final boolean multiToken = field.multiValued() || type.multiValuedFieldCache();
if (method == FacetMethod.FCS
&& multiToken) {
method = FacetMethod.FC;
}
return method;
}