Class TopGroups<T>
- java.lang.Object
-
- org.apache.lucene.search.grouping.TopGroups<T>
-
public class TopGroups<T> extends java.lang.ObjectRepresents result returned by a grouping search.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTopGroups.ScoreMergeModeHow the GroupDocs score (if any) should be merged.
-
Field Summary
Fields Modifier and Type Field Description GroupDocs<T>[]groupsGroup results in groupSort orderSortField[]groupSortHow groups are sorted against each otherfloatmaxScoreHighest score across all hits, orFloat.NaNif scores were not computed.java.lang.IntegertotalGroupCountThe total number of unique groups.inttotalGroupedHitCountNumber of documents grouped into the topN groupsinttotalHitCountNumber of documents matching the searchSortField[]withinGroupSortHow docs are sorted within each group
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> TopGroups<T>merge(TopGroups<T>[] shardGroups, Sort groupSort, Sort docSort, int docOffset, int docTopN, TopGroups.ScoreMergeMode scoreMergeMode)Merges an array of TopGroups, for example obtained from the second-pass collector across multiple shards.private static floatnonNANmax(float a, float b)If either value is NaN then return the other value, otherwise return the greater of the two values by calling Math.max.
-
-
-
Field Detail
-
totalHitCount
public final int totalHitCount
Number of documents matching the search
-
totalGroupedHitCount
public final int totalGroupedHitCount
Number of documents grouped into the topN groups
-
totalGroupCount
public final java.lang.Integer totalGroupCount
The total number of unique groups. Ifnullthis value is not computed.
-
groupSort
public final SortField[] groupSort
How groups are sorted against each other
-
withinGroupSort
public final SortField[] withinGroupSort
How docs are sorted within each group
-
maxScore
public final float maxScore
Highest score across all hits, orFloat.NaNif scores were not computed.
-
-
Method Detail
-
nonNANmax
private static float nonNANmax(float a, float b)If either value is NaN then return the other value, otherwise return the greater of the two values by calling Math.max.- Parameters:
a- - one valueb- - another value- Returns:
- ignoring any NaN return the greater of a and b
-
merge
public static <T> TopGroups<T> merge(TopGroups<T>[] shardGroups, Sort groupSort, Sort docSort, int docOffset, int docTopN, TopGroups.ScoreMergeMode scoreMergeMode)
Merges an array of TopGroups, for example obtained from the second-pass collector across multiple shards. Each TopGroups must have been sorted by the same groupSort and docSort, and the top groups passed to all second-pass collectors must be the same. NOTE: We can't always compute an exact totalGroupCount. Documents belonging to a group may occur on more than one shard and thus the merged totalGroupCount can be higher than the actual totalGroupCount. In this case the totalGroupCount represents a upper bound. If the documents of one group do only reside in one shard then the totalGroupCount is exact. NOTE: the topDocs in each GroupDocs is actually an instance of TopDocsAndShards
-
-