1 package org.apache.lucene.search.grouping;
4 * Licensed to the Apache Software Foundation (ASF) under one or more
5 * contributor license agreements. See the NOTICE file distributed with
6 * this work for additional information regarding copyright ownership.
7 * The ASF licenses this file to You under the Apache License, Version 2.0
8 * (the "License"); you may not use this file except in compliance with
9 * the License. You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
20 import org.apache.lucene.search.ScoreDoc;
22 /** Represents one group in the results.
24 * @lucene.experimental */
25 public class GroupDocs<GROUP_VALUE_TYPE> {
26 /** The groupField value for all docs in this group; this
27 * may be null if hits did not have the groupField. */
28 public final GROUP_VALUE_TYPE groupValue;
30 /** Max score in this group */
31 public final float maxScore;
33 /** Hits; this may be {@link
34 * org.apache.lucene.search.FieldDoc} instances if the
35 * withinGroupSort sorted by fields. */
36 public final ScoreDoc[] scoreDocs;
38 /** Total hits within this group */
39 public final int totalHits;
41 /** Matches the groupSort passed to {@link
42 * AbstractFirstPassGroupingCollector}. */
43 public final Object[] groupSortValues;
45 public GroupDocs(float maxScore,
48 GROUP_VALUE_TYPE groupValue,
49 Object[] groupSortValues) {
50 this.maxScore = maxScore;
51 this.totalHits = totalHits;
52 this.scoreDocs = scoreDocs;
53 this.groupValue = groupValue;
54 this.groupSortValues = groupSortValues;