Java 类org.apache.lucene.search.grouping.function.FunctionDistinctValuesCollector 实例源码

项目:search    文件:DistinctValuesCollectorTest.java   
@SuppressWarnings({"unchecked","rawtypes"})
private <T extends Comparable> AbstractDistinctValuesCollector<AbstractDistinctValuesCollector.GroupCount<T>> createDistinctCountCollector(AbstractFirstPassGroupingCollector<T> firstPassGroupingCollector,
                                                                    String groupField,
                                                                    String countField,
                                                                    DocValuesType dvType) {
  Random random = random();
  Collection<SearchGroup<T>> searchGroups = firstPassGroupingCollector.getTopGroups(0, false);
  if (FunctionFirstPassGroupingCollector.class.isAssignableFrom(firstPassGroupingCollector.getClass())) {
    return (AbstractDistinctValuesCollector) new FunctionDistinctValuesCollector(new HashMap<>(), new BytesRefFieldSource(groupField), new BytesRefFieldSource(countField), (Collection) searchGroups);
  } else {
    return (AbstractDistinctValuesCollector) new TermDistinctValuesCollector(groupField, countField, (Collection) searchGroups);
  }
}
项目:NYBC    文件:DistinctValuesCollectorTest.java   
@SuppressWarnings({"unchecked","rawtypes"})
private <T extends Comparable> AbstractDistinctValuesCollector<AbstractDistinctValuesCollector.GroupCount<T>> createDistinctCountCollector(AbstractFirstPassGroupingCollector<T> firstPassGroupingCollector,
                                                                    String groupField,
                                                                    String countField,
                                                                    DocValuesType dvType) {
  Random random = random();
  Collection<SearchGroup<T>> searchGroups = firstPassGroupingCollector.getTopGroups(0, false);
  if (FunctionFirstPassGroupingCollector.class.isAssignableFrom(firstPassGroupingCollector.getClass())) {
    return (AbstractDistinctValuesCollector) new FunctionDistinctValuesCollector(new HashMap<Object, Object>(), new BytesRefFieldSource(groupField), new BytesRefFieldSource(countField), (Collection) searchGroups);
  } else {
    return (AbstractDistinctValuesCollector) new TermDistinctValuesCollector(groupField, countField, (Collection) searchGroups);
  }
}
项目:Maskana-Gestor-de-Conocimiento    文件:DistinctValuesCollectorTest.java   
@SuppressWarnings({"unchecked","rawtypes"})
private <T extends Comparable> AbstractDistinctValuesCollector<AbstractDistinctValuesCollector.GroupCount<T>> createDistinctCountCollector(AbstractFirstPassGroupingCollector<T> firstPassGroupingCollector,
                                                                    String groupField,
                                                                    String countField,
                                                                    DocValuesType dvType) {
  Random random = random();
  Collection<SearchGroup<T>> searchGroups = firstPassGroupingCollector.getTopGroups(0, false);
  if (FunctionFirstPassGroupingCollector.class.isAssignableFrom(firstPassGroupingCollector.getClass())) {
    return (AbstractDistinctValuesCollector) new FunctionDistinctValuesCollector(new HashMap<Object, Object>(), new BytesRefFieldSource(groupField), new BytesRefFieldSource(countField), (Collection) searchGroups);
  } else {
    return (AbstractDistinctValuesCollector) new TermDistinctValuesCollector(groupField, countField, (Collection) searchGroups);
  }
}