QueryResponses.cs, DumpIndex.cs, IQueryResult.cs, QueryExecutor.cs, QueryResult.cs...
[beagle.git] / beagled / Lucene.Net / Search / HitCollector.cs
blobd861d6b4a8b539491e0d57c16a9de9bfd35fb12b
1 /*
2 * Copyright 2004 The Apache Software Foundation
3 *
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
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
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.
17 using System;
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.
25 /// </summary>
26 /// <seealso cref="Searcher.Search(Query,HitCollector)">
27 /// </seealso>
28 /// <version> $Id: HitCollector.cs,v 1.4 2006/10/02 17:09:04 joeshaw Exp $
29 /// </version>
30 public abstract class HitCollector
32 /// <summary>Called once for every non-zero scoring document, with the document number
33 /// and its score.
34 ///
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) {
41 /// bits.set(doc);
42 /// }
43 /// });
44 /// </pre>
45 ///
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
54 /// between 0 and 1.
55 /// </summary>
56 public abstract void Collect(int doc, float score);