C# Класс Lucene.Net.Search.IndexSearcher

Implements search over a single IndexReader.

Applications usually need only call the inherited {@link #Search(Query)} or {@link #Search(Query,Filter)} methods. For performance reasons it is recommended to open only one IndexSearcher and use it for all of your searches.

Note that you can only access Hits from an IndexSearcher as long as it is not yet closed, otherwise an IOException will be thrown.

Наследование: Searcher
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
Doc ( int i ) : Lucene.Net.Documents.Document
Doc ( int i, Lucene.Net.Documents.FieldSelector fieldSelector ) : Lucene.Net.Documents.Document
DocFreq ( Lucene.Net.Index.Term term ) : int
Explain ( Weight weight, int doc ) : Explanation
IndexSearcher ( IndexReader r ) : System

Creates a searcher searching the provided index

Note that the underlying IndexReader is not closed, if IndexSearcher was constructed with IndexSearcher(IndexReader r). If the IndexReader was supplied implicitly by specifying a directory, then the IndexReader gets closed.

IndexSearcher ( IndexReader reader, IndexReader subReaders, int docStarts ) : System

Expert: directly specify the reader, subReaders and their DocID starts

NOTE: This API is experimental and might change in incompatible ways in the next release

IndexSearcher ( Lucene.Net.Store.Directory path ) : System

Creates a searcher searching the index in the named directory, with readOnly=true

IndexSearcher ( Lucene.Net.Store.Directory path, bool readOnly ) : System

Creates a searcher searching the index in the named directory. You should pass readOnly=true, since it gives much better concurrent performance, unless you intend to do write operations (delete documents or change norms) with the underlying IndexReader.

Rewrite ( Query original ) : Query
Search ( Weight weight, Filter filter, int nDocs ) : Lucene.Net.Search.TopDocs
Search ( Weight weight, Filter filter, int nDocs, Lucene.Net.Search.Sort sort ) : Lucene.Net.Search.TopFieldDocs
Search ( Weight weight, Filter filter, int nDocs, Lucene.Net.Search.Sort sort, bool fillFields ) : Lucene.Net.Search.TopFieldDocs

Just like Search(Weight, Filter, int, Sort), but you choose whether or not the fields in the returned FieldDoc instances should be set by specifying fillFields.

NOTE: this does not compute scores by default. If you need scores, create a TopFieldCollector instance by calling TopFieldCollector.Create and then pass that to Search(Weight, Filter, Collector).

Search ( Weight weight, Filter filter, Collector collector ) : void
SetDefaultFieldSortScoring ( bool doTrackScores, bool doMaxScore ) : void

By default, no scores are computed when sorting by field (using Searcher.Search(Query,Filter,int,Sort)). You can change that, per IndexSearcher instance, by calling this method. Note that this will incur a CPU cost.

Защищенные методы

Метод Описание
Dispose ( bool disposing ) : void
GatherSubReaders ( System allSubReaders, IndexReader r ) : void

Приватные методы

Метод Описание
IndexSearcher ( IndexReader r, bool closeReader ) : System
SearchWithFilter ( IndexReader reader, Weight weight, Filter filter, Collector collector ) : void

Описание методов

Dispose() защищенный метод

protected Dispose ( bool disposing ) : void
disposing bool
Результат void

Doc() публичный метод

public Doc ( int i ) : Lucene.Net.Documents.Document
i int
Результат Lucene.Net.Documents.Document

Doc() публичный метод

public Doc ( int i, Lucene.Net.Documents.FieldSelector fieldSelector ) : Lucene.Net.Documents.Document
i int
fieldSelector Lucene.Net.Documents.FieldSelector
Результат Lucene.Net.Documents.Document

DocFreq() публичный метод

public DocFreq ( Lucene.Net.Index.Term term ) : int
term Lucene.Net.Index.Term
Результат int

Explain() публичный метод

public Explain ( Weight weight, int doc ) : Explanation
weight Weight
doc int
Результат Explanation

GatherSubReaders() защищенный метод

protected GatherSubReaders ( System allSubReaders, IndexReader r ) : void
allSubReaders System
r Lucene.Net.Index.IndexReader
Результат void

IndexSearcher() публичный метод

Creates a searcher searching the provided index

Note that the underlying IndexReader is not closed, if IndexSearcher was constructed with IndexSearcher(IndexReader r). If the IndexReader was supplied implicitly by specifying a directory, then the IndexReader gets closed.

public IndexSearcher ( IndexReader r ) : System
r Lucene.Net.Index.IndexReader
Результат System

IndexSearcher() публичный метод

Expert: directly specify the reader, subReaders and their DocID starts

NOTE: This API is experimental and might change in incompatible ways in the next release

public IndexSearcher ( IndexReader reader, IndexReader subReaders, int docStarts ) : System
reader Lucene.Net.Index.IndexReader
subReaders Lucene.Net.Index.IndexReader
docStarts int
Результат System

IndexSearcher() публичный метод

Creates a searcher searching the index in the named directory, with readOnly=true
public IndexSearcher ( Lucene.Net.Store.Directory path ) : System
path Lucene.Net.Store.Directory
Результат System

IndexSearcher() публичный метод

Creates a searcher searching the index in the named directory. You should pass readOnly=true, since it gives much better concurrent performance, unless you intend to do write operations (delete documents or change norms) with the underlying IndexReader.
public IndexSearcher ( Lucene.Net.Store.Directory path, bool readOnly ) : System
path Lucene.Net.Store.Directory directory where IndexReader will be opened ///
readOnly bool if true, the underlying IndexReader /// will be opened readOnly ///
Результат System

Rewrite() публичный метод

public Rewrite ( Query original ) : Query
original Query
Результат Query

Search() публичный метод

public Search ( Weight weight, Filter filter, int nDocs ) : Lucene.Net.Search.TopDocs
weight Weight
filter Filter
nDocs int
Результат Lucene.Net.Search.TopDocs

Search() публичный метод

public Search ( Weight weight, Filter filter, int nDocs, Lucene.Net.Search.Sort sort ) : Lucene.Net.Search.TopFieldDocs
weight Weight
filter Filter
nDocs int
sort Lucene.Net.Search.Sort
Результат Lucene.Net.Search.TopFieldDocs

Search() публичный метод

Just like Search(Weight, Filter, int, Sort), but you choose whether or not the fields in the returned FieldDoc instances should be set by specifying fillFields.

NOTE: this does not compute scores by default. If you need scores, create a TopFieldCollector instance by calling TopFieldCollector.Create and then pass that to Search(Weight, Filter, Collector).

public Search ( Weight weight, Filter filter, int nDocs, Lucene.Net.Search.Sort sort, bool fillFields ) : Lucene.Net.Search.TopFieldDocs
weight Weight
filter Filter
nDocs int
sort Lucene.Net.Search.Sort
fillFields bool
Результат Lucene.Net.Search.TopFieldDocs

Search() публичный метод

public Search ( Weight weight, Filter filter, Collector collector ) : void
weight Weight
filter Filter
collector Collector
Результат void

SetDefaultFieldSortScoring() публичный метод

By default, no scores are computed when sorting by field (using Searcher.Search(Query,Filter,int,Sort)). You can change that, per IndexSearcher instance, by calling this method. Note that this will incur a CPU cost.
public SetDefaultFieldSortScoring ( bool doTrackScores, bool doMaxScore ) : void
doTrackScores bool If true, then scores are returned for every matching document /// in . /// ///
doMaxScore bool If true, then the max score for all matching docs is computed. ///
Результат void