Lucene.Net  3.0.3
Lucene.Net is a .NET port of the Java Lucene Indexing Library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties
Public Member Functions | Properties | List of all members
Lucene.Net.Search.ScoreCachingWrappingScorer Class Reference

A Scorer which wraps another scorer and caches the score of the current document. Successive calls to Score() will return the same result and will not invoke the wrapped Scorer's score() method, unless the current document has changed.
This class might be useful due to the changes done to the Collector interface, in which the score is not computed for a document by default, only if the collector requests it. Some collectors may need to use the score in several places, however all they have in hand is a Scorer object, and might end up computing the score of a document more than once. More...

Inherits Lucene.Net.Search.Scorer.

Public Member Functions

 ScoreCachingWrappingScorer (Scorer scorer)
 Creates a new instance by wrapping the given scorer.
 
override bool Score (Collector collector, int max, int firstDocID)
 Expert: Collects matching documents in a range. Hook for optimization. Note, firstDocID is added to ensure that DocIdSetIterator.NextDoc() was called before this method.
 
override float Score ()
 Returns the score of the current document matching the query. Initially invalid, until DocIdSetIterator.NextDoc() or DocIdSetIterator.Advance(int) is called the first time, or when called from within Collector.Collect(int).
 
override int DocID ()
 Returns the following:


 
override int NextDoc ()
 Advances to the next document in the set and returns the doc it is currently on, or NO_MORE_DOCS if there are no more docs in the set.

 
override void Score (Collector collector)
 Scores and collects all matching documents.
 
override int Advance (int target)
 Advances to the first beyond the current whose document number is greater than or equal to target. Returns the current document number or NO_MORE_DOCS if there are no more docs in the set. Behaves as if written:
 

Properties

override Similarity Similarity [get]
 
- Properties inherited from Lucene.Net.Search.Scorer
virtual Similarity Similarity [get]
 Returns the Similarity implementation used by this scorer.
 

Additional Inherited Members

- Static Public Attributes inherited from Lucene.Net.Search.DocIdSetIterator
static readonly int NO_MORE_DOCS = System.Int32.MaxValue
 When returned by NextDoc(), Advance(int) and DocID() it means there are no more docs in the iterator.
 

Detailed Description

A Scorer which wraps another scorer and caches the score of the current document. Successive calls to Score() will return the same result and will not invoke the wrapped Scorer's score() method, unless the current document has changed.
This class might be useful due to the changes done to the Collector interface, in which the score is not computed for a document by default, only if the collector requests it. Some collectors may need to use the score in several places, however all they have in hand is a Scorer object, and might end up computing the score of a document more than once.

Definition at line 33 of file ScoreCachingWrappingScorer.cs.

Constructor & Destructor Documentation

Lucene.Net.Search.ScoreCachingWrappingScorer.ScoreCachingWrappingScorer ( Scorer  scorer)

Creates a new instance by wrapping the given scorer.

Definition at line 41 of file ScoreCachingWrappingScorer.cs.

Member Function Documentation

override int Lucene.Net.Search.ScoreCachingWrappingScorer.Advance ( int  target)
virtual

Advances to the first beyond the current whose document number is greater than or equal to target. Returns the current document number or NO_MORE_DOCS if there are no more docs in the set. Behaves as if written:

int advance(int target) { int doc; while ((doc = nextDoc()) < target) { } return doc; }

Some implementations are considerably more efficient than that.

NOTE: certain implemenations may return a different value (each time) if called several times in a row with the same target.

NOTE: this method may be called with NO_MORE_DOCS for efficiency by some Scorers. If your implementation cannot efficiently determine that it should exhaust, it is recommended that you check for that value in each call to this method.

NOTE: after the iterator has exhausted you should not call this method, as it may result in unpredicted behavior.

<since>2.9</since>

Implements Lucene.Net.Search.DocIdSetIterator.

Definition at line 83 of file ScoreCachingWrappingScorer.cs.

override int Lucene.Net.Search.ScoreCachingWrappingScorer.DocID ( )
virtual

Returns the following:

Implements Lucene.Net.Search.DocIdSetIterator.

Definition at line 68 of file ScoreCachingWrappingScorer.cs.

override int Lucene.Net.Search.ScoreCachingWrappingScorer.NextDoc ( )
virtual

Advances to the next document in the set and returns the doc it is currently on, or NO_MORE_DOCS if there are no more docs in the set.

NOTE: after the iterator has exhausted you should not call this method, as it may result in unpredicted behavior.

Implements Lucene.Net.Search.DocIdSetIterator.

Definition at line 73 of file ScoreCachingWrappingScorer.cs.

override bool Lucene.Net.Search.ScoreCachingWrappingScorer.Score ( Collector  collector,
int  max,
int  firstDocID 
)
virtual

Expert: Collects matching documents in a range. Hook for optimization. Note, firstDocID is added to ensure that DocIdSetIterator.NextDoc() was called before this method.

Parameters
collectorThe collector to which all matching documents are passed.
maxDo not score documents past this.
firstDocIDThe first document ID (ensures DocIdSetIterator.NextDoc() is called before this method.
Returns
true if more matching documents may remain.

Reimplemented from Lucene.Net.Search.Scorer.

Definition at line 46 of file ScoreCachingWrappingScorer.cs.

override float Lucene.Net.Search.ScoreCachingWrappingScorer.Score ( )
virtual

Returns the score of the current document matching the query. Initially invalid, until DocIdSetIterator.NextDoc() or DocIdSetIterator.Advance(int) is called the first time, or when called from within Collector.Collect(int).

Implements Lucene.Net.Search.Scorer.

Definition at line 56 of file ScoreCachingWrappingScorer.cs.

override void Lucene.Net.Search.ScoreCachingWrappingScorer.Score ( Collector  collector)
virtual

Scores and collects all matching documents.

Parameters
collectorThe collector to which all matching documents are passed.

Reimplemented from Lucene.Net.Search.Scorer.

Definition at line 78 of file ScoreCachingWrappingScorer.cs.

Property Documentation

override Similarity Lucene.Net.Search.ScoreCachingWrappingScorer.Similarity
get

Definition at line 52 of file ScoreCachingWrappingScorer.cs.


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