DatasetTypeGenerator typeGenerator = (DatasetTypeGenerator) datasetGenerator; ObjectCount[] topCounts = solrLoggerService .queryFacetField(query, defaultFilterQuery, typeGenerator.getType(), typeGenerator.getMax(), typeGenerator.isIncludeTotal(), null);
DatasetTypeGenerator typeAxis = new DatasetTypeGenerator(); typeAxis.setType("countryCode"); typeAxis.setMax(10); statListing.addDatasetGenerator(typeAxis); DatasetTypeGenerator typeAxis = new DatasetTypeGenerator(); typeAxis.setType("city"); typeAxis.setMax(10); statListing.addDatasetGenerator(typeAxis);
/** * Retrieve the total counts for the facets (total count is same query but none of the filter queries). * * @param typeGenerator the type generator * @return counts for each facet by name. * @throws org.apache.solr.client.solrj.SolrServerException passed through. */ protected Map<String, Long> getTotalFacetCounts(DatasetTypeGenerator typeGenerator) throws SolrServerException { ObjectCount[] objectCounts = solrLoggerService .queryFacetField(getQuery(), null, typeGenerator.getType(), -1, false, null); Map<String, Long> result = new HashMap<String, Long>(); for (ObjectCount objectCount : objectCounts) { result.put(objectCount.getValue(), objectCount.getCount()); } return result; }
statisticsTable.setId("tab1"); DatasetTypeGenerator typeAxis = new DatasetTypeGenerator(); typeAxis.setType("countryCode"); typeAxis.setMax(10); statisticsTable.addDatasetGenerator(typeAxis); statisticsTable.setId("tab1"); DatasetTypeGenerator typeAxis = new DatasetTypeGenerator(); typeAxis.setType("city"); typeAxis.setMax(10); statisticsTable.addDatasetGenerator(typeAxis);