Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.lucene.search.grouping
Class TopGroups<GROUP_VALUE_TYPE>

    java.lang.Object
      org.apache.lucene.search.grouping.TopGroups<GROUP_VALUE_TYPE>

    public class TopGroups<GROUP_VALUE_TYPE>

extends Object

Represents result returned by a grouping search.

WARNING: This API is experimental and might change in incompatible ways in the next release.

Field Summary
`GroupDocs<GROUP_VALUE_TYPE>[]` | `groups` Group results in groupSort order
`org.apache.lucene.search.SortField[]` | `groupSort` How groups are sorted against each other
`Integer` | `totalGroupCount` The total number of unique groups.
`int` | `totalGroupedHitCount` Number of documents grouped into the topN groups
`int` | `totalHitCount` Number of documents matching the search
`org.apache.lucene.search.SortField[]` | `withinGroupSort` How docs are sorted within each group

Constructor Summary
`TopGroups(org.apache.lucene.search.SortField[] groupSort, org.apache.lucene.search.SortField[] withinGroupSort, int totalHitCount, int totalGroupedHitCount, GroupDocs<GROUP_VALUE_TYPE>[] groups)`
`TopGroups(TopGroups<GROUP_VALUE_TYPE> oldTopGroups, Integer totalGroupCount)`

Method Summary
`static
`<T> TopGroups<T>`
` | `merge(TopGroups<T>[] shardGroups, org.apache.lucene.search.Sort groupSort, org.apache.lucene.search.Sort docSort, int docOffset, int docTopN)` Merges an array of TopGroups, for example obtained from the second-pass collector across multiple shards.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

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 Integer totalGroupCount

  The total number of unique groups. If `null` this value is not computed.

### groups

    public final GroupDocs<GROUP_VALUE_TYPE>[] groups

  Group results in groupSort order

### groupSort

    public final org.apache.lucene.search.SortField[] groupSort

  How groups are sorted against each other

### withinGroupSort

    public final org.apache.lucene.search.SortField[] withinGroupSort

  How docs are sorted within each group

Constructor Detail

### TopGroups

    public TopGroups(org.apache.lucene.search.SortField[] groupSort,
                     org.apache.lucene.search.SortField[] withinGroupSort,
                     int totalHitCount,
                     int totalGroupedHitCount,
                     GroupDocs<GROUP_VALUE_TYPE>[] groups)

### TopGroups

    public TopGroups(TopGroups<GROUP_VALUE_TYPE> oldTopGroups,
                     Integer totalGroupCount)

Method Detail

### merge

    public static <T> TopGroups<T> merge(TopGroups<T>[] shardGroups,
                                         org.apache.lucene.search.Sort groupSort,
                                         org.apache.lucene.search.Sort docSort,
                                         int docOffset,
                                         int docTopN)
                              throws IOException

  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

  Throws:
    `IOException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD