Lucene.Net
3.0.3
Lucene.Net is a .NET port of the Java Lucene Indexing Library
|
A Collector implementation that collects the top-scoring hits, returning them as a TopDocs. This is used by IndexSearcher to implement TopDocs-based search. Hits are sorted by score descending and then (when the scores are tied) docID ascending. When you create an instance of this collector you should know in advance whether documents are going to be collected in doc Id order or not. More...
Inherits Lucene.Net.Search.TopDocsCollector< T >.
Inherited by Lucene.Net.Search.TopScoreDocCollector.InOrderTopScoreDocCollector, and Lucene.Net.Search.TopScoreDocCollector.OutOfOrderTopScoreDocCollector.
Public Member Functions | |
override TopDocs | NewTopDocs (ScoreDoc[] results, int start) |
Returns a Lucene.Net.Search.TopDocs instance containing the given results. If results is null it means there are no results to return, either because there were 0 calls to collect() or because the arguments to topDocs were invalid. | |
override void | SetNextReader (IndexReader reader, int base_Renamed) |
Called before collecting from each IndexReader. All doc ids in Collect(int) will correspond to reader. | |
override void | SetScorer (Scorer scorer) |
Called before successive calls to Collect(int). Implementations that need the score of the current document (passed-in to Collect(int)), should save the passed-in Scorer and call scorer.score() when needed. | |
Public Member Functions inherited from Lucene.Net.Search.TopDocsCollector< T > | |
TopDocs | TopDocs () |
Returns the top docs that were collected by this collector. | |
TopDocs | TopDocs (int start) |
Returns the documents in the rage [start .. pq.size()) that were collected by this collector. Note that if start >= pq.size(), an empty TopDocs is returned. This method is convenient to call if the application allways asks for the last results, starting from the last 'page'. NOTE: you cannot call this method more than once for each search execution. If you need to call it more than once, passing each time a different start , you should call TopDocs() and work with the returned Lucene.Net.Search.TopDocs object, which will contain all the results this search execution collected. | |
TopDocs | TopDocs (int start, int howMany) |
Returns the documents in the rage [start .. start+howMany) that were collected by this collector. Note that if start >= pq.size(), an empty TopDocs is returned, and if pq.size() - start < howMany, then only the available documents in [start .. pq.size()) are returned. This method is useful to call in case pagination of search results is allowed by the search application, as well as it attempts to optimize the memory used by allocating only as much as requested by howMany. NOTE: you cannot call this method more than once for each search execution. If you need to call it more than once, passing each time a different range, you should call TopDocs() and work with the returned Lucene.Net.Search.TopDocs object, which will contain all the results this search execution collected. | |
Public Member Functions inherited from Lucene.Net.Search.Collector | |
abstract void | Collect (int doc) |
Called once for every document matching a query, with the unbased document number. | |
Static Public Member Functions | |
static TopScoreDocCollector | Create (int numHits, bool docsScoredInOrder) |
Creates a new TopScoreDocCollector given the number of hits to collect and whether documents are scored in order by the input Scorer to SetScorer(Scorer). | |
Additional Inherited Members | |
Properties inherited from Lucene.Net.Search.TopDocsCollector< T > | |
virtual int | TotalHits [get] |
The total number of documents that matched this query. | |
A Collector implementation that collects the top-scoring hits, returning them as a TopDocs. This is used by IndexSearcher to implement TopDocs-based search. Hits are sorted by score descending and then (when the scores are tied) docID ascending. When you create an instance of this collector you should know in advance whether documents are going to be collected in doc Id order or not.
NOTE: The values float.NaN and float.NegativeInfinity are not valid scores. This collector will not properly collect hits with such scores.
Definition at line 37 of file TopScoreDocCollector.cs.
|
static |
Creates a new TopScoreDocCollector given the number of hits to collect and whether documents are scored in order by the input Scorer to SetScorer(Scorer).
NOTE: The instances returned by this method pre-allocate a full array of length numHits
, and fill the array with sentinel objects.
Definition at line 114 of file TopScoreDocCollector.cs.
|
virtual |
Returns a Lucene.Net.Search.TopDocs instance containing the given results. If results
is null it means there are no results to return, either because there were 0 calls to collect() or because the arguments to topDocs were invalid.
Reimplemented from Lucene.Net.Search.TopDocsCollector< T >.
Definition at line 139 of file TopScoreDocCollector.cs.
|
virtual |
Called before collecting from each IndexReader. All doc ids in Collect(int) will correspond to reader.
Add docBase to the current IndexReaders internal document id to re-base ids in Collect(int).
reader | next IndexReader |
docBase |
Implements Lucene.Net.Search.Collector.
Definition at line 167 of file TopScoreDocCollector.cs.
|
virtual |
Called before successive calls to Collect(int). Implementations that need the score of the current document (passed-in to Collect(int)), should save the passed-in Scorer and call scorer.score() when needed.
Implements Lucene.Net.Search.Collector.
Definition at line 172 of file TopScoreDocCollector.cs.