The TopScoreDocCollector type exposes the following members.

Methods

  NameDescription
Public methodAcceptsDocsOutOfOrder
* Return
CopyC#
true
if this collector does not * require the matching docIDs to be delivered in int sort * order (smallest to largest) to {@link #collect}. * *

Most Lucene Query implementations will visit * matching docIDs in order. However, some queries * (currently limited to certain cases of {@link * BooleanQuery}) can achieve faster searching if the *

CopyC#
Collector
allows them to deliver the * docIDs out of order. * *

Many collectors don't mind getting docIDs out of * order, so it's important to return

CopyC#
true
* here. *
(Inherited from Collector.)
Public methodCollect
Called once for every document matching a query, with the unbased document number.

Note: This is called in an inner search loop. For good search performance, implementations of this method should not call {@link Searcher#Doc(int)} or {@link Lucene.Net.Index.IndexReader#Document(int)} on every hit. Doing so can slow searches by an order of magnitude or more.

(Inherited from Collector.)
Public methodStatic membercreate
Creates a new {@link TopScoreDocCollector} given the number of hits to collect and whether documents are scored in order by the input {@link Scorer} to {@link #SetScorer(Scorer)}.

NOTE: The instances returned by this method pre-allocate a full array of length

CopyC#
numHits
, and fill the array with sentinel objects.
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Protected methodFinalize
Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetTotalHits
The total number of documents that matched this query.
(Inherited from TopDocsCollector.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodNewTopDocs (Overrides TopDocsCollector..::..NewTopDocs(array<ScoreDoc>[]()[][], Int32).)
Protected methodPopulateResults
Populates the results array with the ScoreDoc instaces. This can be overridden in case a different ScoreDoc type should be returned.
(Inherited from TopDocsCollector.)
Public methodSetNextReader (Overrides Collector..::..SetNextReader(IndexReader, Int32).)
Public methodSetScorer (Overrides Collector..::..SetScorer(Scorer).)
Public methodTopDocs()()()()
Returns the top docs that were collected by this collector.
(Inherited from TopDocsCollector.)
Public methodTopDocs(Int32)
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
CopyC#
start
, you should call {@link #TopDocs()} and work with the returned {@link TopDocs} object, which will contain all the results this search execution collected.
(Inherited from TopDocsCollector.)
Public methodTopDocs(Int32, Int32)
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 {@link #TopDocs()} and work with the returned {@link TopDocs} object, which will contain all the results this search execution collected.
(Inherited from TopDocsCollector.)
Public methodToString
Returns a String that represents the current Object.
(Inherited from Object.)

See Also