2 * Copyright 2004 The Apache Software Foundation
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 namespace Lucene
.Net
.Search
22 /// <summary>Lower-level search API.
23 /// <br>HitCollectors are primarily meant to be used to implement queries,
24 /// sorting and filtering.
26 /// <seealso cref="Searcher.Search(Query,HitCollector)">
28 /// <version> $Id: HitCollector.cs,v 1.4 2006/10/02 17:09:04 joeshaw Exp $
30 public abstract class HitCollector
32 /// <summary>Called once for every non-zero scoring document, with the document number
35 /// <P>If, for example, an application wished to collect all of the hits for a
36 /// query in a BitSet, then it might:<pre>
37 /// Searcher searcher = new IndexSearcher(indexReader);
38 /// final BitSet bits = new BitSet(indexReader.maxDoc());
39 /// searcher.search(query, new HitCollector() {
40 /// public void collect(int doc, float score) {
46 /// <p>Note: This is called in an inner search loop. For good search
47 /// performance, implementations of this method should not call
48 /// {@link Searcher#Doc(int)} or
49 /// {@link Lucene.Net.index.IndexReader#Document(int)} on every
50 /// document number encountered. Doing so can slow searches by an order
51 /// of magnitude or more.
52 /// <p>Note: The <code>score</code> passed to this method is a raw score.
53 /// In other words, the score will not necessarily be a float whose value is
56 public abstract void Collect(int doc
, float score
);