C# Class Lucene.Net.Search.Searcher

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.

Inheritance: Lucene.Net.Search.Searchable
Show file Open project: synhershko/lucene.net Class Usage Examples

Public Methods

Method Description
CreateWeight ( Query query ) : Weight

creates a weight for query

Dispose ( ) : void
Doc ( int i ) : Lucene.Net.Documents.Document
Doc ( int docid, FieldSelector fieldSelector ) : Lucene.Net.Documents.Document
DocFreq ( Lucene.Net.Index.Term term ) : int
DocFreqs ( Lucene.Net.Index.Term terms ) : int[]
Explain ( Query query, int doc ) : Explanation

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.

Explain ( Weight weight, int doc ) : Explanation
Rewrite ( Query query ) : Query
Search ( Query query, Filter filter, int n ) : Lucene.Net.Search.TopDocs

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

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

Finds the top n hits for query.

Search ( Weight weight, Filter filter, int n ) : Lucene.Net.Search.TopDocs
Search ( Query query, Filter filter, int n, Lucene.Net.Search.Sort sort ) : Lucene.Net.Search.TopFieldDocs

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.

Search ( Weight weight, Filter filter, int n, Lucene.Net.Search.Sort sort ) : Lucene.Net.Search.TopFieldDocs
Search ( Query query, Collector results ) : void

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.

Search ( Query query, Filter filter, Collector results ) : void

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.

Search ( Weight weight, Filter filter, Collector results ) : void

Protected Methods

Method Description
Dispose ( bool disposing ) : void
Searcher ( ) : System

Private Methods

Method Description
Close ( ) : void
InitBlock ( ) : void

Method Details

CreateWeight() public method

creates a weight for query
public CreateWeight ( Query query ) : Weight
query Query
return Weight

Dispose() public method

public Dispose ( ) : void
return void

Dispose() protected abstract method

protected abstract Dispose ( bool disposing ) : void
disposing bool
return void

Doc() public abstract method

public abstract Doc ( int i ) : Lucene.Net.Documents.Document
i int
return Lucene.Net.Documents.Document

Doc() public abstract method

public abstract Doc ( int docid, FieldSelector fieldSelector ) : Lucene.Net.Documents.Document
docid int
fieldSelector FieldSelector
return Lucene.Net.Documents.Document

DocFreq() public abstract method

public abstract DocFreq ( Lucene.Net.Index.Term term ) : int
term Lucene.Net.Index.Term
return int

DocFreqs() public method

public DocFreqs ( Lucene.Net.Index.Term terms ) : int[]
terms Lucene.Net.Index.Term
return int[]

Explain() public method

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.

public Explain ( Query query, int doc ) : Explanation
query Query
doc int
return Explanation

Explain() public abstract method

public abstract Explain ( Weight weight, int doc ) : Explanation
weight Weight
doc int
return Explanation

Rewrite() public abstract method

public abstract Rewrite ( Query query ) : Query
query Query
return Query

Search() public method

Finds the top n hits for query, applying filter if non-null.
public Search ( Query query, Filter filter, int n ) : Lucene.Net.Search.TopDocs
query Query
filter Filter
n int
return Lucene.Net.Search.TopDocs

Search() public method

Finds the top n hits for query.
public Search ( Query query, int n ) : Lucene.Net.Search.TopDocs
query Query
n int
return Lucene.Net.Search.TopDocs

Search() public abstract method

public abstract Search ( Weight weight, Filter filter, int n ) : Lucene.Net.Search.TopDocs
weight Weight
filter Filter
n int
return Lucene.Net.Search.TopDocs

Search() public method

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.

public Search ( Query query, Filter filter, int n, Lucene.Net.Search.Sort sort ) : Lucene.Net.Search.TopFieldDocs
query Query
filter Filter
n int
sort Lucene.Net.Search.Sort
return Lucene.Net.Search.TopFieldDocs

Search() public abstract method

public abstract Search ( Weight weight, Filter filter, int n, Lucene.Net.Search.Sort sort ) : Lucene.Net.Search.TopFieldDocs
weight Weight
filter Filter
n int
sort Lucene.Net.Search.Sort
return Lucene.Net.Search.TopFieldDocs

Search() public method

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.

public Search ( Query query, Collector results ) : void
query Query
results Collector
return void

Search() public method

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.

public Search ( Query query, Filter filter, Collector results ) : void
query Query to match documents ///
filter Filter if non-null, used to permit documents to be collected. ///
results Collector to receive hits ///
return void

Search() public abstract method

public abstract Search ( Weight weight, Filter filter, Collector results ) : void
weight Weight
filter Filter
results Collector
return void

Searcher() protected method

protected Searcher ( ) : System
return System