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.Collector;
21 import org.apache.lucene.search.Scorer;
22 import org.apache.lucene.util.BytesRef;
24 import java.io.IOException;
25 import java.util.Collection;
28 * A collector that collects all groups that match the
29 * query. Only the group value is collected, and the order
30 * is undefined. This collector does not determine
31 * the most relevant document of a group.
34 * This is an abstract version. Concrete implementations define
35 * what a group actually is and how it is internally collected.
37 * @lucene.experimental
39 public abstract class AbstractAllGroupsCollector<GROUP_VALUE_TYPE> extends Collector {
42 * Returns the total number of groups for the executed search.
43 * This is a convenience method. The following code snippet has the same effect: <pre>getGroups().size()</pre>
45 * @return The total number of groups for the executed search
47 public int getGroupCount() {
48 return getGroups().size();
52 * Returns the group values
54 * This is an unordered collections of group values. For each group that matched the query there is a {@link BytesRef}
55 * representing a group value.
57 * @return the group values
59 public abstract Collection<GROUP_VALUE_TYPE> getGroups();
61 // Empty not necessary
62 public void setScorer(Scorer scorer) throws IOException {}
64 public boolean acceptsDocsOutOfOrder() {