Lucene.Net  3.0.3
Lucene.Net is a .NET port of the Java Lucene Indexing Library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties
Public Member Functions | Protected Member Functions | Properties | List of all members
Lucene.Net.Search.Searcher Class Referenceabstract

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 nth 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.
 

Detailed Description

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.

Constructor & Destructor Documentation

Lucene.Net.Search.Searcher.Searcher ( )
protected

Definition at line 36 of file Searcher.cs.

Member Function Documentation

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.

virtual Weight Lucene.Net.Search.Searcher.CreateWeight ( Query  query)
virtual

creates a weight for query

Returns
new weight

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.

abstract void Lucene.Net.Search.Searcher.Dispose ( bool  disposing)
protectedpure virtual
abstract Document Lucene.Net.Search.Searcher.Doc ( int  i)
pure virtual

Expert: Returns the stored fields of document i.

See Also
Lucene.Net.Index.IndexReader.Document(int)

<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.

abstract Document Lucene.Net.Search.Searcher.Doc ( int  n,
FieldSelector  fieldSelector 
)
pure virtual

Get the Lucene.Net.Documents.Documentat the nth 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.

Parameters
nGet the document at the nth position
fieldSelectorThe 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.
Returns
The stored fields of the Lucene.Net.Documents.Document at the nth position

<throws> CorruptIndexException if the index is corrupt </throws> <throws> IOException if there is a low-level IO error </throws>

See Also
Lucene.Net.Index.IndexReader.Document(int, FieldSelector)
See Also
IFieldable
See Also
Lucene.Net.Documents.FieldSelector
See Also
Lucene.Net.Documents.SetBasedFieldSelector
See Also
Lucene.Net.Documents.LoadFirstFieldSelector

Implements Lucene.Net.Search.Searchable.

Implemented in Lucene.Net.Search.MultiSearcher, and Lucene.Net.Search.IndexSearcher.

abstract int Lucene.Net.Search.Searcher.DocFreq ( Term  term)
pure virtual

Expert: Returns the number of documents containing term. Called by search code to compute term weights.

See Also
Lucene.Net.Index.IndexReader.DocFreq(Term)

Implements Lucene.Net.Search.Searchable.

Implemented in Lucene.Net.Search.MultiSearcher, Lucene.Net.Search.IndexSearcher, and Lucene.Net.Search.ParallelMultiSearcher.

virtual int [] Lucene.Net.Search.Searcher.DocFreqs ( Term[]  terms)
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 Explanation Lucene.Net.Search.Searcher.Explain ( Query  query,
int  doc 
)
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.

abstract Explanation Lucene.Net.Search.Searcher.Explain ( Weight  weight,
int  doc 
)
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.

abstract Query Lucene.Net.Search.Searcher.Rewrite ( Query  query)
pure virtual

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 TopFieldDocs Lucene.Net.Search.Searcher.Search ( Query  query,
Filter  filter,
int  n,
Sort  sort 
)
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.

virtual void Lucene.Net.Search.Searcher.Search ( Query  query,
Collector  results 
)
virtual

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 void Lucene.Net.Search.Searcher.Search ( Query  query,
Filter  filter,
Collector  results 
)
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.

Parameters
queryto match documents
filterif non-null, used to permit documents to be collected.
resultsto receive hits

<throws> BooleanQuery.TooManyClauses </throws>

Definition at line 96 of file Searcher.cs.

virtual TopDocs Lucene.Net.Search.Searcher.Search ( Query  query,
Filter  filter,
int  n 
)
virtual

Finds the top n hits for query, applying filter if non-null.

<throws> BooleanQuery.TooManyClauses </throws>

Definition at line 106 of file Searcher.cs.

virtual TopDocs Lucene.Net.Search.Searcher.Search ( Query  query,
int  n 
)
virtual

Finds the top n hits for query.

<throws> BooleanQuery.TooManyClauses </throws>

Definition at line 116 of file Searcher.cs.

abstract void Lucene.Net.Search.Searcher.Search ( Weight  weight,
Filter  filter,
Collector  collector 
)
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.

Parameters
weightto match documents
filterif non-null, used to permit documents to be collected.
collectorto 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.

abstract TopDocs Lucene.Net.Search.Searcher.Search ( Weight  weight,
Filter  filter,
int  n 
)
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.

abstract TopFieldDocs Lucene.Net.Search.Searcher.Search ( Weight  weight,
Filter  filter,
int  n,
Sort  sort 
)
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.

Property Documentation

abstract int Lucene.Net.Search.Searcher.MaxDoc
get

Definition at line 183 of file Searcher.cs.

virtual Similarity Lucene.Net.Search.Searcher.Similarity
getset

Expert: Gets or Sets the Similarity implementation used by this Searcher.

See Also
Lucene.Net.Search.Similarity.Default

Definition at line 143 of file Searcher.cs.


The documentation for this class was generated from the following file: