Lucene.Net  3.0.3
Lucene.Net is a port of the Lucene search engine library, written in C# and targeted at .NET runtime users.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Pages
Public Member Functions | Properties | List of all members
Lucene.Net.Search.TopDocsCollector< T > Class Template Reference

A base class for all collectors that return a Lucene.Net.Search.TopDocs output. This collector allows easy extension by providing a single constructor which accepts a PriorityQueue{T} as well as protected members for that priority queue and a counter of the number of total hits.
Extending classes can override TopDocs(int, int) and TotalHits in order to provide their own implementation. More...

Inherits Lucene.Net.Search.Collector.

Inherited by Lucene.Net.Search.TopFieldCollector, and Lucene.Net.Search.TopScoreDocCollector.

Public Member Functions

virtual 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.
 
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 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.
 
abstract void Collect (int doc)
 Called once for every document matching a query, with the unbased document number.
 
abstract void SetNextReader (IndexReader reader, int docBase)
 Called before collecting from each IndexReader. All doc ids in Collect(int) will correspond to reader.
 

Properties

virtual int TotalHits [get]
 The total number of documents that matched this query.
 
- Properties inherited from Lucene.Net.Search.Collector
abstract bool AcceptsDocsOutOfOrder [get]
 Return true if this collector does not require the matching docIDs to be delivered in int sort order (smallest to largest) to Collect. Most Lucene Query implementations will visit matching docIDs in order. However, some queries (currently limited to certain cases of BooleanQuery) can achieve faster searching if the 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 true here.
 

Detailed Description

A base class for all collectors that return a Lucene.Net.Search.TopDocs output. This collector allows easy extension by providing a single constructor which accepts a PriorityQueue{T} as well as protected members for that priority queue and a counter of the number of total hits.
Extending classes can override TopDocs(int, int) and TotalHits in order to provide their own implementation.

Type Constraints
T :ScoreDoc 

Definition at line 30 of file TopDocsCollector.cs.

Member Function Documentation

virtual TopDocs Lucene.Net.Search.TopDocsCollector< T >.NewTopDocs ( ScoreDoc[]  results,
int  start 
)
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 in Lucene.Net.Search.TopFieldCollector, and Lucene.Net.Search.TopScoreDocCollector.

Definition at line 68 of file TopDocsCollector.cs.

TopDocs Lucene.Net.Search.TopDocsCollector< T >.TopDocs ( )

Returns the top docs that were collected by this collector.

Definition at line 80 of file TopDocsCollector.cs.

TopDocs Lucene.Net.Search.TopDocsCollector< T >.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.

Definition at line 99 of file TopDocsCollector.cs.

TopDocs Lucene.Net.Search.TopDocsCollector< T >.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.

Definition at line 120 of file TopDocsCollector.cs.

Property Documentation

virtual int Lucene.Net.Search.TopDocsCollector< T >.TotalHits
get

The total number of documents that matched this query.

Definition at line 75 of file TopDocsCollector.cs.


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