((NamedObjectsQuery) query).setName(object, name);
}
}
private void processStatsOptions(SolrQuery solrQuery, Query query) {
StatsOptions statsOptions = query.getStatsOptions();
if (statsOptions == null
|| (CollectionUtils.isEmpty(statsOptions.getFields()) && CollectionUtils.isEmpty(statsOptions.getFacets()) && CollectionUtils
.isEmpty(statsOptions.getSelectiveFacets()))) {
return;
}
solrQuery.set(StatsParams.STATS, true);
for (Field field : statsOptions.getFields()) {
solrQuery.add(StatsParams.STATS_FIELD, field.getName());
String selectiveCalcDistinctParam = CommonParams.FIELD + "." + field.getName() + "."
+ StatsParams.STATS_CALC_DISTINCT;
Boolean selectiveCountDistincts = statsOptions.isSelectiveCalcDistincts(field);
if (selectiveCountDistincts != null) {
solrQuery.add(selectiveCalcDistinctParam, String.valueOf(selectiveCountDistincts.booleanValue()));
}
}
for (Field field : statsOptions.getFacets()) {
solrQuery.add(StatsParams.STATS_FACET, field.getName());
}
for (Entry<Field, Collection<Field>> entry : statsOptions.getSelectiveFacets().entrySet()) {
Field field = entry.getKey();
String prefix = CommonParams.FIELD + "." + field.getName() + ".";
String paramName = prefix + StatsParams.STATS_FACET;