7#ifndef CUSTOMSCOREQUERY_H
8#define CUSTOMSCOREQUERY_H
78 virtual double customScore(int32_t doc,
double subQueryScore,
double valSrcScore);
126 friend class CustomWeight;
127 friend class CustomScorer;
#define LUCENE_CLASS(Name)
Definition: LuceneObject.h:24
Query that sets document score as a programmatic function of several (sub) scores:
Definition: CustomScoreQuery.h:21
virtual bool isStrict()
Checks if this is strict custom scoring. In strict custom scoring, the ValueSource part does not part...
CustomScoreQuery(const QueryPtr &subQuery, const ValueSourceQueryPtr &valSrcQuery)
Create a CustomScoreQuery over input subQuery and a ValueSourceQuery.
virtual ExplanationPtr customExplain(int32_t doc, const ExplanationPtr &subQueryExpl, Collection< ExplanationPtr > valSrcExpls)
Explain the custom score.
virtual QueryPtr rewrite(const IndexReaderPtr &reader)
Called to re-write queries into primitive queries. For example, a PrefixQuery will be rewritten into ...
void ConstructQuery(const QueryPtr &subQuery, Collection< ValueSourceQueryPtr > valSrcQueries)
virtual String name()
A short name of this query, used in toString(String).
virtual bool equals(const LuceneObjectPtr &other)
Return whether two objects are equal.
virtual ExplanationPtr customExplain(int32_t doc, const ExplanationPtr &subQueryExpl, const ExplanationPtr &valSrcExpl)
Explain the custom score.
virtual void setStrict(bool strict)
Set the strict mode of this query.
virtual void extractTerms(SetTerm terms)
Adds all terms occurring in this query to the terms set. Only works if this query is in its rewritten...
virtual String toString(const String &field)
Prints a query to a string, with field assumed to be the default field and omitted.
QueryPtr subQuery
Definition: CustomScoreQuery.h:46
virtual double customScore(int32_t doc, double subQueryScore, double valSrcScore)
Compute a custom score by the subQuery score and the ValueSourceQuery score.
virtual WeightPtr createWeight(const SearcherPtr &searcher)
Constructs an appropriate Weight implementation for this query. Only implemented by primitive queries...
bool strict
Definition: CustomScoreQuery.h:48
Collection< ValueSourceQueryPtr > valSrcQueries
Definition: CustomScoreQuery.h:47
virtual ~CustomScoreQuery()
virtual LuceneObjectPtr clone(const LuceneObjectPtr &other=LuceneObjectPtr())
Returns a clone of this query.
CustomScoreQuery(const QueryPtr &subQuery)
Create a CustomScoreQuery over input subQuery.
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 int32_t hashCode()
Return hash code for this object.
CustomScoreQuery(const QueryPtr &subQuery, Collection< ValueSourceQueryPtr > valSrcQueries)
Create a CustomScoreQuery over input subQuery and a ValueSourceQuery.
virtual CustomScoreProviderPtr getCustomScoreProvider(const IndexReaderPtr &reader)
Returns a CustomScoreProvider that calculates the custom scores for the given IndexReader....
The abstract base class for queries.
Definition: Query.h:31
virtual String toString()
Prints a query to a string.
Definition: AbstractAllTermDocs.h:12
boost::shared_ptr< LuceneObject > LuceneObjectPtr
Definition: LuceneTypes.h:539
boost::shared_ptr< CustomScoreProvider > CustomScoreProviderPtr
Definition: LuceneTypes.h:309
boost::shared_ptr< Query > QueryPtr
Definition: LuceneTypes.h:420
boost::shared_ptr< ValueSourceQuery > ValueSourceQueryPtr
Definition: LuceneTypes.h:477
boost::shared_ptr< Searcher > SearcherPtr
Definition: LuceneTypes.h:434
boost::shared_ptr< Explanation > ExplanationPtr
Definition: LuceneTypes.h:333
boost::shared_ptr< IndexReader > IndexReaderPtr
Definition: LuceneTypes.h:157
boost::shared_ptr< Weight > WeightPtr
Definition: LuceneTypes.h:480