Calculate query weights and build query scorers.
More...
#include <Weight.h>
Calculate query weights and build query scorers.
The purpose of Weight
is to ensure searching does not modify a Query
, so that a Query
instance can be reused. Searcher
dependent state of the query should reside in the Weight
. IndexReader
dependent state should reside in the Scorer
.
Weight is used in the following way:
-
A Weight is constructed by a top-level query, given a Searcher (
Query#createWeight(Searcher)
).
-
The
sumOfSquaredWeights()
method is called on the Weight to compute the query normalization factor Similarity#queryNorm(float)
of the query clauses contained in the query.
-
The query normalization factor is passed to
normalize(float)
. At this point the weighting is complete.
-
A Scorer is constructed by
scorer(IndexReaderPtr, bool, bool)
.
◆ ~Weight()
virtual Lucene::Weight::~Weight |
( |
| ) |
|
|
virtual |
◆ _getClassName()
static String Lucene::Weight::_getClassName |
( |
| ) |
|
|
inlinestatic |
◆ explain()
An explanation of the score computation for the named document.
- Parameters
-
reader | sub-reader containing the give doc |
doc | |
- Returns
- an Explanation for the score
Implemented in Lucene::SpanWeight.
◆ getClassName()
virtual String Lucene::Weight::getClassName |
( |
| ) |
|
|
inlinevirtual |
◆ getQuery()
virtual QueryPtr Lucene::Weight::getQuery |
( |
| ) |
|
|
pure virtual |
◆ getValue()
virtual double Lucene::Weight::getValue |
( |
| ) |
|
|
pure virtual |
◆ normalize()
virtual void Lucene::Weight::normalize |
( |
double |
norm | ) |
|
|
pure virtual |
◆ scorer()
Returns a Scorer
which scores documents in/out-of order according to scoreDocsInOrder.
NOTE: even if scoreDocsInOrder is false, it is recommended to check whether the returned Scorer indeed scores documents out of order (ie., call scoresDocsOutOfOrder()
), as some Scorer implementations will always return documents in-order.
NOTE: null can be returned if no documents will be scored by this query.
- Parameters
-
reader | The IndexReader for which to return the Scorer . |
scoreDocsInOrder | Specifies whether in-order scoring of documents is required. Note that if set to false (i.e., out-of-order scoring is required), this method can return whatever scoring mode it supports, as every in-order scorer is also an out-of-order one. However, an out-of-order scorer may not support Scorer#nextDoc() and/or Scorer#advance(int) , therefore it is recommended to request an in-order scorer if use of these methods is required. |
topScorer | If true, Scorer#score(CollectorPtr) will be called; if false, Scorer#nextDoc() and/or Scorer#advance(int) will be called. |
- Returns
- a
Scorer
which scores documents in/out-of order.
Implemented in Lucene::PayloadNearSpanWeight, and Lucene::SpanWeight.
◆ scoresDocsOutOfOrder()
virtual bool Lucene::Weight::scoresDocsOutOfOrder |
( |
| ) |
|
|
virtual |
◆ shared_from_this()
boost::shared_ptr< Weight > Lucene::Weight::shared_from_this |
( |
| ) |
|
|
inline |
◆ sumOfSquaredWeights()
virtual double Lucene::Weight::sumOfSquaredWeights |
( |
| ) |
|
|
pure virtual |
The documentation for this class was generated from the following file: