Thumbnail file hits. Based on a patch from D Bera
[beagle.git] / beagled / Lucene.Net / Search / Searcher.cs
blobd41594e892dcefe7911be8529235aeead97faf00
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
20 /// <summary>An abstract base class for search implementations.
21 /// Implements some common utility methods.
22 /// </summary>
23 public abstract class Searcher : Lucene.Net.Search.Searchable
25 public Searcher()
27 InitBlock();
29 private void InitBlock()
31 similarity = Similarity.GetDefault();
33 /// <summary>Returns the documents matching <code>query</code>. </summary>
34 public Hits Search(Query query)
36 return Search(query, (Filter) null);
39 /// <summary>Returns the documents matching <code>query</code> and
40 /// <code>filter</code>.
41 /// </summary>
42 public virtual Hits Search(Query query, Filter filter)
44 return new Hits(this, query, filter);
47 /// <summary>Returns documents matching <code>query</code> sorted by
48 /// <code>sort</code>.
49 /// </summary>
50 public virtual Hits Search(Query query, Sort sort)
52 return new Hits(this, query, null, sort);
55 /// <summary>Returns documents matching <code>query</code> and <code>filter</code>,
56 /// sorted by <code>sort</code>.
57 /// </summary>
58 public virtual Hits Search(Query query, Filter filter, Sort sort)
60 return new Hits(this, query, filter, sort);
63 /// <summary>Lower-level search API.
64 ///
65 /// <p>{@link HitCollector#Collect(int,float)} is called for every non-zero
66 /// scoring document.
67 ///
68 /// <p>Applications should only use this if they need <i>all</i> of the
69 /// matching documents. The high-level search API ({@link
70 /// Searcher#Search(Query)}) is usually more efficient, as it skips
71 /// non-high-scoring hits.
72 /// <p>Note: The <code>score</code> passed to this method is a raw score.
73 /// In other words, the score will not necessarily be a float whose value is
74 /// between 0 and 1.
75 /// </summary>
76 public virtual void Search(Query query, HitCollector results)
78 Search(query, (Filter) null, results);
81 /// <summary>The Similarity implementation used by this searcher. </summary>
82 private Similarity similarity;
84 /// <summary>Expert: Set the Similarity implementation used by this Searcher.
85 ///
86 /// </summary>
87 /// <seealso cref="Similarity#SetDefault(Similarity)">
88 /// </seealso>
89 public virtual void SetSimilarity(Similarity similarity)
91 this.similarity = similarity;
94 /// <summary>Expert: Return the Similarity implementation used by this Searcher.
95 ///
96 /// <p>This defaults to the current value of {@link Similarity#GetDefault()}.
97 /// </summary>
98 public virtual Similarity GetSimilarity()
100 return this.similarity;
102 public abstract void Close();
103 public abstract Lucene.Net.Search.Explanation Explain(Lucene.Net.Search.Query param1, int param2);
104 public abstract Lucene.Net.Search.TopFieldDocs Search(Lucene.Net.Search.Query param1, Lucene.Net.Search.Filter param2, int param3, Lucene.Net.Search.Sort param4);
105 public abstract void Search(Lucene.Net.Search.Query param1, Lucene.Net.Search.Filter param2, Lucene.Net.Search.HitCollector param3);
106 public abstract int DocFreq(Lucene.Net.Index.Term param1);
107 public abstract int MaxDoc();
108 public abstract Lucene.Net.Search.Query Rewrite(Lucene.Net.Search.Query param1);
109 public abstract Lucene.Net.Documents.Document Doc(int param1);
110 public abstract Lucene.Net.Search.TopDocs Search(Lucene.Net.Search.Query param1, Lucene.Net.Search.Filter param2, int param3);