Lucene.Net
3.0.3
Lucene.Net is a .NET port of the Java Lucene Indexing Library
|
An abstract base class for search implementations. Implements the main search methods. More...
Inherits MarshalByRefObject, Lucene.Net.Search.Searchable, and IDisposable.
Inherited by Lucene.Net.Search.IndexSearcher, Lucene.Net.Search.MultiSearcher, and Lucene.Net.Search.MultiSearcher.CachedDfSource.
Public Member Functions | |
virtual TopFieldDocs | Search (Query query, Filter filter, int n, Sort sort) |
Search implementation with arbitrary sorting. Finds the top n hits for query , applying filter if non-null, and sorting the hits by the criteria in sort . | |
virtual void | Search (Query query, Collector results) |
Lower-level search API. | |
virtual void | Search (Query query, Filter filter, Collector results) |
Lower-level search API. | |
virtual TopDocs | Search (Query query, Filter filter, int n) |
Finds the top n hits for query , applying filter if non-null. | |
virtual TopDocs | Search (Query query, int n) |
Finds the top n hits for query . | |
virtual Explanation | Explain (Query query, int doc) |
Returns an Explanation that describes how doc scored against query . | |
virtual Weight | CreateWeight (Query query) |
creates a weight for query | |
virtual int[] | DocFreqs (Term[] terms) |
Expert: For each term in the terms array, calculates the number of documents containing term . Returns an array with these document frequencies. Used to minimize number of remote calls. | |
abstract void | Search (Weight weight, Filter filter, Collector results) |
Lower-level search API. | |
void | Close () |
Frees resources associated with this Searcher. Be careful not to call this method while you are still using objects that reference this searchable | |
void | Dispose () |
abstract int | DocFreq (Term term) |
Expert: Returns the number of documents containing term . Called by search code to compute term weights. | |
abstract TopDocs | Search (Weight weight, Filter filter, int n) |
Expert: Low-level search implementation. Finds the top n hits for query , applying filter if non-null. | |
abstract Document | Doc (int i) |
Expert: Returns the stored fields of document i . | |
abstract Document | Doc (int docid, FieldSelector fieldSelector) |
Get the Lucene.Net.Documents.Documentat the n th position. The Lucene.Net.Documents.FieldSelector may be used to determine what Lucene.Net.Documents.Fields to load and how they should be loaded. | |
abstract Query | Rewrite (Query query) |
Expert: called to re-write queries into primitive queries. | |
abstract Explanation | Explain (Weight weight, int doc) |
Expert: low-level implementation method Returns an Explanation that describes how doc scored against weight . | |
abstract TopFieldDocs | Search (Weight weight, Filter filter, int n, Sort sort) |
Expert: Low-level search implementation with arbitrary sorting. Finds the top n hits for query , applying filter if non-null, and sorting the hits by the criteria in sort . | |
Protected Member Functions | |
Searcher () | |
abstract void | Dispose (bool disposing) |
Properties | |
virtual Similarity | Similarity [get, set] |
Expert: Gets or Sets the Similarity implementation used by this Searcher. | |
abstract int | MaxDoc [get] |
Properties inherited from Lucene.Net.Search.Searchable | |
int | MaxDoc [get] |
Expert: Returns one greater than the largest possible document number. Called by search code to compute term weights. | |
An abstract base class for search implementations. Implements the main search methods.
Note that you can only access hits from a Searcher as long as it is not yet closed, otherwise an IOException will be thrown.
Definition at line 34 of file Searcher.cs.
|
protected |
Definition at line 36 of file Searcher.cs.
void Lucene.Net.Search.Searcher.Close | ( | ) |
Frees resources associated with this Searcher. Be careful not to call this method while you are still using objects that reference this searchable
Implements Lucene.Net.Search.Searchable.
Definition at line 170 of file Searcher.cs.
creates a weight for query
Reimplemented in Lucene.Net.Search.MultiSearcher.
Definition at line 151 of file Searcher.cs.
void Lucene.Net.Search.Searcher.Dispose | ( | ) |
Definition at line 175 of file Searcher.cs.
|
protectedpure virtual |
Implemented in Lucene.Net.Search.MultiSearcher, and Lucene.Net.Search.IndexSearcher.
|
pure virtual |
Expert: Returns the stored fields of document i
.
<throws> CorruptIndexException if the index is corrupt </throws> <throws> IOException if there is a low-level IO error </throws>
Implements Lucene.Net.Search.Searchable.
Implemented in Lucene.Net.Search.MultiSearcher, and Lucene.Net.Search.IndexSearcher.
|
pure virtual |
Get the Lucene.Net.Documents.Documentat the n
th position. The Lucene.Net.Documents.FieldSelector may be used to determine what Lucene.Net.Documents.Fields to load and how they should be loaded.
NOTE: If the underlying Reader (more specifically, the underlying FieldsReader
) is closed before the lazy Lucene.Net.Documents.Field is loaded an exception may be thrown. If you want the value of a lazy Lucene.Net.Documents.Field to be available after closing you must explicitly load it or fetch the Document again with a new loader.
n | Get the document at the n th position |
fieldSelector | The Lucene.Net.Documents.FieldSelector to use to determine what Fields should be loaded on the Document. May be null, in which case all Fields will be loaded. |
<throws> CorruptIndexException if the index is corrupt </throws> <throws> IOException if there is a low-level IO error </throws>
Implements Lucene.Net.Search.Searchable.
Implemented in Lucene.Net.Search.MultiSearcher, and Lucene.Net.Search.IndexSearcher.
|
pure virtual |
Expert: Returns the number of documents containing term
. Called by search code to compute term weights.
Implements Lucene.Net.Search.Searchable.
Implemented in Lucene.Net.Search.MultiSearcher, Lucene.Net.Search.IndexSearcher, and Lucene.Net.Search.ParallelMultiSearcher.
|
virtual |
Expert: For each term in the terms array, calculates the number of documents containing term
. Returns an array with these document frequencies. Used to minimize number of remote calls.
Implements Lucene.Net.Search.Searchable.
Definition at line 157 of file Searcher.cs.
|
virtual |
Returns an Explanation that describes how doc
scored against query
.
This is intended to be used in developing Similarity implementations, and, for good performance, should not be displayed with every hit. Computing an explanation is as expensive as executing the query over the entire index.
Definition at line 129 of file Searcher.cs.
|
pure virtual |
Expert: low-level implementation method Returns an Explanation that describes how doc
scored against weight
.
This is intended to be used in developing Similarity implementations, and, for good performance, should not be displayed with every hit. Computing an explanation is as expensive as executing the query over the entire index.
Applications should call Searcher.Explain(Query, int).
<throws> BooleanQuery.TooManyClauses </throws>
Implements Lucene.Net.Search.Searchable.
Implemented in Lucene.Net.Search.MultiSearcher, and Lucene.Net.Search.IndexSearcher.
Expert: called to re-write queries into primitive queries.
<throws> BooleanQuery.TooManyClauses </throws>
Implements Lucene.Net.Search.Searchable.
Implemented in Lucene.Net.Search.MultiSearcher, and Lucene.Net.Search.IndexSearcher.
|
virtual |
Search implementation with arbitrary sorting. Finds the top n
hits for query
, applying filter
if non-null, and sorting the hits by the criteria in sort
.
NOTE: this does not compute scores by default; use IndexSearcher.SetDefaultFieldSortScoring(bool,bool) to enable scoring.
<throws> BooleanQuery.TooManyClauses </throws>
Definition at line 55 of file Searcher.cs.
Lower-level search API.
Collector.Collect(int) is called for every matching document.
Applications should only use this if they need all of the matching documents. The high-level search API (Searcher.Search(Query, int) ) is usually more efficient, as it skips non-high-scoring hits.
Note: The score
passed to this method is a raw score. In other words, the score will not necessarily be a float whose value is between 0 and 1.
<throws> BooleanQuery.TooManyClauses </throws>
Definition at line 72 of file Searcher.cs.
|
virtual |
Lower-level search API.
Collector.Collect(int) is called for every matching document.
Collector-based access to remote indexes is discouraged.
Applications should only use this if they need all of the matching documents. The high-level search API (Searcher.Search(Query, Filter, int)) is usually more efficient, as it skips non-high-scoring hits.
query | to match documents |
filter | if non-null, used to permit documents to be collected. |
results | to receive hits |
<throws> BooleanQuery.TooManyClauses </throws>
Definition at line 96 of file Searcher.cs.
Finds the top n
hits for query
, applying filter
if non-null.
<throws> BooleanQuery.TooManyClauses </throws>
Definition at line 106 of file Searcher.cs.
Finds the top n
hits for query
.
<throws> BooleanQuery.TooManyClauses </throws>
Definition at line 116 of file Searcher.cs.
|
pure virtual |
Lower-level search API.
Collector.Collect(int) is called for every document.
Collector-based access to remote indexes is discouraged.
Applications should only use this if they need all of the matching documents. The high-level search API (Searcher.Search(Query,int)) is usually more efficient, as it skips non-high-scoring hits.
weight | to match documents |
filter | if non-null, used to permit documents to be collected. |
collector | to receive hits |
<throws> BooleanQuery.TooManyClauses </throws>
Implements Lucene.Net.Search.Searchable.
Implemented in Lucene.Net.Search.MultiSearcher, Lucene.Net.Search.IndexSearcher, and Lucene.Net.Search.ParallelMultiSearcher.
|
pure virtual |
Expert: Low-level search implementation. Finds the top n
hits for query
, applying filter
if non-null.
Applications should usually call Searcher.Search(Query, int) or Searcher.Search(Query,Filter,int) instead.
<throws> BooleanQuery.TooManyClauses </throws>
Implements Lucene.Net.Search.Searchable.
Implemented in Lucene.Net.Search.MultiSearcher, Lucene.Net.Search.IndexSearcher, and Lucene.Net.Search.ParallelMultiSearcher.
|
pure virtual |
Expert: Low-level search implementation with arbitrary sorting. Finds the top n
hits for query
, applying filter
if non-null, and sorting the hits by the criteria in sort
.
Applications should usually call Searcher.Search(Query,Filter,int,Sort) instead.
<throws> BooleanQuery.TooManyClauses </throws>
Implements Lucene.Net.Search.Searchable.
Implemented in Lucene.Net.Search.MultiSearcher, Lucene.Net.Search.IndexSearcher, and Lucene.Net.Search.ParallelMultiSearcher.
|
get |
Definition at line 183 of file Searcher.cs.
|
getset |
Expert: Gets or Sets the Similarity implementation used by this Searcher.
Definition at line 143 of file Searcher.cs.