pylucene 3.5.0-3
[pylucene.git] / lucene-java-3.5.0 / lucene / contrib / facet / src / java / org / apache / lucene / facet / search / aggregator / Aggregator.java
1 package org.apache.lucene.facet.search.aggregator;
2
3 import java.io.IOException;
4
5 /**
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
12  *
13  *     http://www.apache.org/licenses/LICENSE-2.0
14  *
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.
20  */
21
22 /**
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
28  * association values.
29  * <P>
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.
33  * 
34  * @lucene.experimental
35  */
36 public interface Aggregator {
37
38   /**
39    * Specify the document (and its score in the search) that the following
40    * {@link #aggregate(int)} calls will pertain to.
41    */
42   void setNextDoc(int docid, float score) throws IOException;
43
44   /**
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)}.
48    */
49   void aggregate(int ordinal);
50
51 }