protected Map<String, Map<String, Long>> getFacetCounts(List<String> fields, QueryResponse solrResponse) { Map<String, Map<String, Long>> fieldCounts = new HashMap<>(); for (String field : fields) { Map<String, Long> valueCounts = new HashMap<>(); FacetField facetField = solrResponse.getFacetField(field); for (Count facetCount : facetField.getValues()) { valueCounts.put(facetCount.getName(), facetCount.getCount()); } fieldCounts.put(field, valueCounts); } return fieldCounts; }
if (facetFieldCount.getCount() > 0) { FacetLabel facetLabel = new FacetLabel(facetFieldCount.getName(), facetFieldCount.getCount()); facetLabel.setFilterQuery(facetField.getName() + ":\"" + facetFieldCount.getName() + "\""); facetLabelList.add(facetLabel); if (facetField.getName().equals(SearchFields.PUBLICATION_STATUS)) {
if (facet.getValues() != null) { for (FacetField.Count value : facet.getValues()) { String topicName = value.getName(); int topicCount = (int) value.getCount(); org.nuiton.wikitty.search.FacetTopic topic = new org.nuiton.wikitty.search.FacetTopic(facetName, topicName, topicCount); topics.add(topic);
facetValue.getName()); String field = transformFacetField(facetFieldConfig, facetField.getName(), true); String authorityValue = transformAuthorityValue(context, facetField.getName(), facetValue.getName()); String sortValue = transformSortValue(context, facetField.getName(), facetValue.getName()); String filterValue = displayedValue; if (StringUtils.isNotBlank(authorityValue)) { new DiscoverResult.FacetResult(filterValue, displayedValue, authorityValue, sortValue, facetValue.getCount(), facetFieldConfig.getType()));
String displayedValue = transformDisplayedValue(context, facetField.getName(), facetValue.getName()); String field = transformFacetField(facetFieldConfig, facetField.getName(), true); result.addFacetResult(field, new DiscoverResult.FacetResult(facetValue.getAsFilterQuery(), displayedValue, facetValue.getCount()));
Object key = value.getName(); ObjectField field = mapFullyDenormalizedKey(query, fields[0]).getField(); if (field != null) { key = StateValueUtils.toJavaValue(query.getDatabase(), null, field, field.getInternalItemType(), key); groupings.add(new SolrGrouping<T>(Arrays.asList(key), query, fields, value.getCount()));
String s = ff.getName().equals("type") ? "View" : "Search"; for (FacetField.Count count : ff.getValues()) { String name = count.getName(); int id = Integer.parseInt(name); if (id == Constants.COMMUNITY) { unexpected += count.getCount(); continue; System.out.println(String.format("\t%,12d\t%s", count.getCount(), name)); total += count.getCount();
if (count.getCount() == 0) { continue;
static Map<Field, Page<FacetFieldEntry>> convertFacetQueryResponseToFacetPageMap(FacetQuery query, QueryResponse response) { Assert.notNull(query, "Cannot convert response for 'null', query"); if (!hasFacets(query, response)) { return Collections.emptyMap(); } Map<Field, Page<FacetFieldEntry>> facetResult = new LinkedHashMap<>(); if (!CollectionUtils.isEmpty(response.getFacetFields())) { int initalPageSize = Math.max(1, query.getFacetOptions().getPageable().getPageSize()); for (FacetField facetField : response.getFacetFields()) { if (facetField != null && StringUtils.hasText(facetField.getName())) { Field field = new SimpleField(facetField.getName()); if (!CollectionUtils.isEmpty(facetField.getValues())) { List<FacetFieldEntry> pageEntries = new ArrayList<>(initalPageSize); for (Count count : facetField.getValues()) { if (count != null) { pageEntries.add(new SimpleFacetFieldEntry(field, count.getName(), count.getCount())); } } facetResult.put(field, new SolrResultPage<>(pageEntries, query.getFacetOptions().getPageable(), facetField.getValueCount(), null)); } else { facetResult.put(field, new SolrResultPage<>(Collections.<FacetFieldEntry> emptyList(), query.getFacetOptions().getPageable(), 0, null)); } } } } return facetResult; }
if (count.getCount() == 0) { continue;