Clover Coverage Report
Coverage timestamp: Fri May 9 2008 10:54:27 EST
0   51   0   -
0   4   -   0
0     -  
1    
 
  HitCollector       Line # 25 0 0 - -1.0
 
No Tests
 
1    package org.apache.lucene.search;
2   
3    /**
4    * Copyright 2004 The Apache Software Foundation
5    *
6    * Licensed under the Apache License, Version 2.0 (the "License");
7    * you may not use this file except in compliance with the License.
8    * You may obtain a copy of the License at
9    *
10    * http://www.apache.org/licenses/LICENSE-2.0
11    *
12    * Unless required by applicable law or agreed to in writing, software
13    * distributed under the License is distributed on an "AS IS" BASIS,
14    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15    * See the License for the specific language governing permissions and
16    * limitations under the License.
17    */
18   
19    /** Lower-level search API.
20    * <br>HitCollectors are primarily meant to be used to implement queries,
21    * sorting and filtering.
22    * @see Searcher#search(Query,HitCollector)
23    * @version $Id: HitCollector.java 155607 2005-02-27 01:29:53Z otis $
24    */
 
25    public abstract class HitCollector {
26    /** Called once for every non-zero scoring document, with the document number
27    * and its score.
28    *
29    * <P>If, for example, an application wished to collect all of the hits for a
30    * query in a BitSet, then it might:<pre>
31    * Searcher searcher = new IndexSearcher(indexReader);
32    * final BitSet bits = new BitSet(indexReader.maxDoc());
33    * searcher.search(query, new HitCollector() {
34    * public void collect(int doc, float score) {
35    * bits.set(doc);
36    * }
37    * });
38    * </pre>
39    *
40    * <p>Note: This is called in an inner search loop. For good search
41    * performance, implementations of this method should not call
42    * {@link Searcher#doc(int)} or
43    * {@link org.apache.lucene.index.IndexReader#document(int)} on every
44    * document number encountered. Doing so can slow searches by an order
45    * of magnitude or more.
46    * <p>Note: The <code>score</code> passed to this method is a raw score.
47    * In other words, the score will not necessarily be a float whose value is
48    * between 0 and 1.
49    */
50    public abstract void collect(int doc, float score);
51    }