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
Classes | Public Member Functions | Static Public Member Functions | Properties | List of all members
Lucene.Net.Search.TopFieldCollector Class Reference

A Collector that sorts by SortField using FieldComparators. See the Create method for instantiating a TopFieldCollector. More...

Inherits Lucene.Net.Search.TopDocsCollector< T >.

Inherited by Lucene.Net.Search.TopFieldCollector.MultiComparatorNonScoringCollector, and Lucene.Net.Search.TopFieldCollector.OneComparatorNonScoringCollector.

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.
 
- 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 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.
 

Static Public Member Functions

static TopFieldCollector Create (Sort sort, int numHits, bool fillFields, bool trackDocScores, bool trackMaxScore, bool docsScoredInOrder)
 Creates a new TopFieldCollector from the given arguments.
 

Properties

override bool AcceptsDocsOutOfOrder [get]
 
- Properties inherited from Lucene.Net.Search.TopDocsCollector< T >
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 Collector that sorts by SortField using FieldComparators.

See the Create method for instantiating a TopFieldCollector.

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

Definition at line 35 of file TopFieldCollector.cs.

Member Function Documentation

static TopFieldCollector Lucene.Net.Search.TopFieldCollector.Create ( Sort  sort,
int  numHits,
bool  fillFields,
bool  trackDocScores,
bool  trackMaxScore,
bool  docsScoredInOrder 
)
static

Creates a new TopFieldCollector from the given arguments.

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

Parameters
sortthe sort criteria (SortFields).
numHitsthe number of results to collect.
fillFieldsspecifies whether the actual field values should be returned on the results (FieldDoc).
trackDocScoresspecifies whether document scores should be tracked and set on the results. Note that if set to false, then the results' scores will be set to Float.NaN. Setting this to true affects performance, as it incurs the score computation on each competitive result. Therefore if document scores are not required by the application, it is recommended to set it to false.
trackMaxScorespecifies whether the query's maxScore should be tracked and set on the resulting TopDocs. Note that if set to false, TopDocs.MaxScore returns Float.NaN. Setting this to true affects performance as it incurs the score computation on each result. Also, setting this true automatically sets trackDocScores to true as well.
docsScoredInOrderspecifies whether documents are scored in doc Id order or not by the given Scorer in Collector.SetScorer(Scorer).
Returns
a TopFieldCollector instance which will sort the results by the sort criteria.

<throws> IOException </throws>

Definition at line 1012 of file TopFieldCollector.cs.

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

Definition at line 1119 of file TopFieldCollector.cs.

Property Documentation

override bool Lucene.Net.Search.TopFieldCollector.AcceptsDocsOutOfOrder
get

Definition at line 1133 of file TopFieldCollector.cs.


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