An instance of this subclass should be returned by CustomScoreQuery#getCustomScoreProvider
, if you want to modify the custom score calculation of a CustomScoreQuery
.
More...
#include <CustomScoreProvider.h>
|
| CustomScoreProvider (const IndexReaderPtr &reader) |
| Creates a new instance of the provider class for the given IndexReader .
|
|
virtual | ~CustomScoreProvider () |
|
virtual String | getClassName () |
|
boost::shared_ptr< CustomScoreProvider > | shared_from_this () |
|
virtual double | customScore (int32_t doc, double subQueryScore, Collection< double > valSrcScores) |
| Compute a custom score by the subQuery score and a number of ValueSourceQuery scores.
|
|
virtual double | customScore (int32_t doc, double subQueryScore, double valSrcScore) |
| Compute a custom score by the subQuery score and the ValueSourceQuery score.
|
|
virtual ExplanationPtr | customExplain (int32_t doc, const ExplanationPtr &subQueryExpl, Collection< ExplanationPtr > valSrcExpls) |
| Explain the custom score. Whenever overriding customScore(int32_t, double, Collection<double>) , this method should also be overridden to provide the correct explanation for the part of the custom scoring.
|
|
virtual ExplanationPtr | customExplain (int32_t doc, const ExplanationPtr &subQueryExpl, const ExplanationPtr &valSrcExpl) |
| Explain the custom score. Whenever overriding customScore(int32_t, double, double) , this method should also be overridden to provide the correct explanation for the part of the custom scoring.
|
|
virtual | ~LuceneObject () |
|
virtual void | initialize () |
| Called directly after instantiation to create objects that depend on this object being fully constructed.
|
|
virtual LuceneObjectPtr | clone (const LuceneObjectPtr &other=LuceneObjectPtr()) |
| Return clone of this object.
|
|
virtual int32_t | hashCode () |
| Return hash code for this object.
|
|
virtual bool | equals (const LuceneObjectPtr &other) |
| Return whether two objects are equal.
|
|
virtual int32_t | compareTo (const LuceneObjectPtr &other) |
| Compare two objects.
|
|
virtual String | toString () |
| Returns a string representation of the object.
|
|
virtual | ~LuceneSync () |
|
virtual SynchronizePtr | getSync () |
| Return this object synchronize lock.
|
|
virtual LuceneSignalPtr | getSignal () |
| Return this object signal.
|
|
virtual void | lock (int32_t timeout=0) |
| Lock this object using an optional timeout.
|
|
virtual void | unlock () |
| Unlock this object.
|
|
virtual bool | holdsLock () |
| Returns true if this object is currently locked by current thread.
|
|
virtual void | wait (int32_t timeout=0) |
| Wait for signal using an optional timeout.
|
|
virtual void | notifyAll () |
| Notify all threads waiting for signal.
|
|
An instance of this subclass should be returned by CustomScoreQuery#getCustomScoreProvider
, if you want to modify the custom score calculation of a CustomScoreQuery
.
Since Lucene 2.9, queries operate on each segment of an Index separately, so overriding the similar (now deprecated) methods in CustomScoreQuery
is no longer suitable, as the supplied doc ID is per-segment and without knowledge of the IndexReader you cannot access the document or FieldCache
.
◆ CustomScoreProvider()
Lucene::CustomScoreProvider::CustomScoreProvider |
( |
const IndexReaderPtr & |
reader | ) |
|
Creates a new instance of the provider class for the given IndexReader
.
◆ ~CustomScoreProvider()
virtual Lucene::CustomScoreProvider::~CustomScoreProvider |
( |
| ) |
|
|
virtual |
◆ _getClassName()
static String Lucene::CustomScoreProvider::_getClassName |
( |
| ) |
|
|
inlinestatic |
◆ customExplain() [1/2]
Explain the custom score. Whenever overriding customScore(int32_t, double, Collection<double>)
, this method should also be overridden to provide the correct explanation for the part of the custom scoring.
- Parameters
-
doc | doc being explained. |
subQueryExpl | explanation for the sub-query part. |
valSrcExpls | explanation for the value source part. |
- Returns
- an explanation for the custom score
◆ customExplain() [2/2]
Explain the custom score. Whenever overriding customScore(int32_t, double, double)
, this method should also be overridden to provide the correct explanation for the part of the custom scoring.
- Parameters
-
doc | doc being explained. |
subQueryExpl | explanation for the sub-query part. |
valSrcExpl | explanation for the value source part. |
- Returns
- an explanation for the custom score
◆ customScore() [1/2]
virtual double Lucene::CustomScoreProvider::customScore |
( |
int32_t |
doc, |
|
|
double |
subQueryScore, |
|
|
Collection< double > |
valSrcScores |
|
) |
| |
|
virtual |
Compute a custom score by the subQuery score and a number of ValueSourceQuery scores.
Subclasses can override this method to modify the custom score.
If your custom scoring is different than the default herein you should override at least one of the two customScore() methods. If the number of ValueSourceQueries is always < 2 it is sufficient to override the other customScore()
method, which is simpler.
The default computation herein is a multiplication of given scores:
ModifiedScore = valSrcScore * valSrcScores[0] * valSrcScores[1] * ...
- Parameters
-
doc | id of scored doc. |
subQueryScore | score of that doc by the subQuery. |
valSrcScores | scores of that doc by the ValueSourceQuery. |
- Returns
- custom score.
◆ customScore() [2/2]
virtual double Lucene::CustomScoreProvider::customScore |
( |
int32_t |
doc, |
|
|
double |
subQueryScore, |
|
|
double |
valSrcScore |
|
) |
| |
|
virtual |
Compute a custom score by the subQuery score and the ValueSourceQuery score.
Subclasses can override this method to modify the custom score.
If your custom scoring is different than the default herein you should override at least one of the two customScore() methods. If the number of ValueSourceQueries is always < 2 it is sufficient to override this customScore() method, which is simpler.
The default computation herein is a multiplication of the two scores:
ModifiedScore = subQueryScore * valSrcScore
- Parameters
-
doc | id of scored doc. |
subQueryScore | score of that doc by the subQuery. |
valSrcScore | score of that doc by the ValueSourceQuery. |
- Returns
- custom score.
◆ getClassName()
virtual String Lucene::CustomScoreProvider::getClassName |
( |
| ) |
|
|
inlinevirtual |
◆ shared_from_this()
◆ reader
The documentation for this class was generated from the following file: