SOLR-2898: Support grouped faceting.

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1298194 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Martijn van Groningen 2012-03-07 23:05:58 +00:00
parent 2510af4a99
commit 03f36313c0
1 changed files with 4 additions and 2 deletions

View File

@ -342,11 +342,13 @@ public class SimpleFacets {
boolean orderByCount = sort.equals(FacetParams.FACET_SORT_COUNT) || sort.equals(FacetParams.FACET_SORT_COUNT_LEGACY);
TermGroupFacetCollector.GroupedFacetResult result = collector.mergeSegmentResults(offset + limit, mincount, orderByCount);
CharsRef charsRef = new CharsRef();
FieldType facetFieldType = searcher.getSchema().getFieldType(field);
NamedList<Integer> facetCounts = new NamedList<Integer>();
List<TermGroupFacetCollector.FacetEntry> scopedEntries = result.getFacetEntries(offset, limit);
for (TermGroupFacetCollector.FacetEntry facetEntry : scopedEntries) {
String facetDisplayValue = facetEntry.getValue().utf8ToString();
facetCounts.add(facetDisplayValue, facetEntry.getCount());
facetFieldType.indexedToReadable(facetEntry.getValue(), charsRef);
facetCounts.add(charsRef.toString(), facetEntry.getCount());
}
if (missing) {