Thumbnail file hits. Based on a patch from D Bera
[beagle.git] / beagled / Lucene.Net / Search / HitCollector.cs
bloba30ba4ad1e4ba591cad77bbf5abf3294e21a035c
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.
16 using System;
17 namespace Lucene.Net.Search
19 /// <summary>Lower-level search API.</summary>
20 /// <seealso cref="Searcher#Search(Query,HitCollector)">
21 /// </seealso>
22 /// <version> $Id: HitCollector.cs,v 1.2 2005/01/17 19:54:30 joeshaw Exp $
23 /// </version>
24 public abstract class HitCollector
26 /// <summary>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 Lucene.Net.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 /// </summary>
50 public abstract void Collect(int doc, float score);