1 package org.apache.lucene.facet.search.aggregator;
3 import java.io.IOException;
6 * Licensed to the Apache Software Foundation (ASF) under one or more
7 * contributor license agreements. See the NOTICE file distributed with
8 * this work for additional information regarding copyright ownership.
9 * The ASF licenses this file to You under the Apache License, Version 2.0
10 * (the "License"); you may not use this file except in compliance with
11 * the License. You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
23 * An Aggregator is the analogue of Lucene's Collector (see
24 * {@link org.apache.lucene.search.Collector}), for processing the categories
25 * belonging to a certain document. The Aggregator is responsible for doing
26 * whatever it wishes with the categories it is fed, e.g., counting the number
27 * of times that each category appears, or performing some computation on their
30 * Much of the function of an Aggregator implementation is not described by this
31 * interface. This includes the constructor and getter methods to retrieve the
32 * results of the aggregation.
34 * @lucene.experimental
36 public interface Aggregator {
39 * Specify the document (and its score in the search) that the following
40 * {@link #aggregate(int)} calls will pertain to.
42 void setNextDoc(int docid, float score) throws IOException;
45 * Collect (and do whatever an implementation deems appropriate) the
46 * category given by its ordinal. This category belongs to a document
47 * given earlier by {@link #setNextDoc(int, float)}.
49 void aggregate(int ordinal);