Lucene++ - a full-featured, c++ search engine
API Documentation
Query that sets document score as a programmatic function of several (sub) scores: More...
#include <CustomScoreQuery.h>
Inheritance diagram for Lucene::CustomScoreQuery:Public Member Functions | |
| CustomScoreQuery (const QueryPtr &subQuery) | |
| Create a CustomScoreQuery over input subQuery. More... | |
| CustomScoreQuery (const QueryPtr &subQuery, const ValueSourceQueryPtr &valSrcQuery) | |
Create a CustomScoreQuery over input subQuery and a ValueSourceQuery. More... | |
| CustomScoreQuery (const QueryPtr &subQuery, Collection< ValueSourceQueryPtr > valSrcQueries) | |
Create a CustomScoreQuery over input subQuery and a ValueSourceQuery. More... | |
| virtual | ~CustomScoreQuery () |
| virtual String | getClassName () |
| boost::shared_ptr< CustomScoreQuery > | shared_from_this () |
| virtual QueryPtr | rewrite (const IndexReaderPtr &reader) |
| Called to re-write queries into primitive queries. For example, a PrefixQuery will be rewritten into a BooleanQuery that consists of TermQuerys. More... | |
| 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 form. More... | |
| virtual LuceneObjectPtr | clone (const LuceneObjectPtr &other=LuceneObjectPtr()) |
| Returns a clone of this query. More... | |
| virtual String | toString (const String &field) |
| Prints a query to a string, with field assumed to be the default field and omitted. More... | |
| virtual bool | equals (const LuceneObjectPtr &other) |
| Return whether two objects are equal. More... | |
| virtual int32_t | hashCode () |
| Return hash code for this object. More... | |
| 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. More... | |
| virtual double | customScore (int32_t doc, double subQueryScore, double valSrcScore) |
| Compute a custom score by the subQuery score and the ValueSourceQuery score. More... | |
| virtual ExplanationPtr | customExplain (int32_t doc, const ExplanationPtr &subQueryExpl, Collection< ExplanationPtr > valSrcExpls) |
| Explain the custom score. More... | |
| virtual ExplanationPtr | customExplain (int32_t doc, const ExplanationPtr &subQueryExpl, const ExplanationPtr &valSrcExpl) |
| Explain the custom score. More... | |
| virtual WeightPtr | createWeight (const SearcherPtr &searcher) |
| Constructs an appropriate Weight implementation for this query. Only implemented by primitive queries, which re-write to themselves. More... | |
| virtual bool | isStrict () |
| Checks if this is strict custom scoring. In strict custom scoring, the ValueSource part does not participate in weight normalization. This may be useful when one wants full control over how scores are modified, and does not care about normalizing by the ValueSource part. One particular case where this is useful if for testing this query. More... | |
| virtual void | setStrict (bool strict) |
| Set the strict mode of this query. More... | |
| virtual String | name () |
A short name of this query, used in toString(String). More... | |
| virtual String | toString (const String &field) |
| Prints a query to a string, with field assumed to be the default field and omitted. More... | |
| virtual String | toString () |
| Prints a query to a string. More... | |
Public Member Functions inherited from Lucene::Query | |
| Query () | |
| virtual | ~Query () |
| virtual String | getClassName () |
| boost::shared_ptr< Query > | shared_from_this () |
| virtual void | setBoost (double b) |
| Sets the boost for this query clause to b. Documents matching this clause will (in addition to the normal weightings) have their score multiplied by b. More... | |
| virtual double | getBoost () |
| Gets the boost for this clause. Documents matching this clause will (in addition to the normal weightings) have their score multiplied by b. The boost is 1.0 by default. More... | |
| virtual String | toString (const String &field) |
| Prints a query to a string, with field assumed to be the default field and omitted. More... | |
| virtual String | toString () |
| Prints a query to a string. More... | |
| virtual WeightPtr | createWeight (const SearcherPtr &searcher) |
| Constructs an appropriate Weight implementation for this query. Only implemented by primitive queries, which re-write to themselves. More... | |
| virtual WeightPtr | weight (const SearcherPtr &searcher) |
| Constructs and initializes a Weight for a top-level query. More... | |
| virtual QueryPtr | rewrite (const IndexReaderPtr &reader) |
| Called to re-write queries into primitive queries. For example, a PrefixQuery will be rewritten into a BooleanQuery that consists of TermQuerys. More... | |
| virtual QueryPtr | combine (Collection< QueryPtr > queries) |
| Called when re-writing queries under MultiSearcher. More... | |
| 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 form. More... | |
| virtual SimilarityPtr | getSimilarity (const SearcherPtr &searcher) |
| Returns the Similarity implementation to be used for this query. Subclasses may override this method to specify their own Similarity implementation, perhaps one that delegates through that of the Searcher. By default the Searcher's Similarity implementation is returned. More... | |
| virtual LuceneObjectPtr | clone (const LuceneObjectPtr &other=LuceneObjectPtr()) |
| Returns a clone of this query. More... | |
| virtual int32_t | hashCode () |
| Return hash code for this object. More... | |
| virtual bool | equals (const LuceneObjectPtr &other) |
| Return whether two objects are equal. More... | |
| String | boostString () |
| Return given boost value as a string. More... | |
Public Member Functions inherited from Lucene::LuceneObject | |
| virtual | ~LuceneObject () |
| virtual void | initialize () |
| Called directly after instantiation to create objects that depend on this object being fully constructed. More... | |
| virtual LuceneObjectPtr | clone (const LuceneObjectPtr &other=LuceneObjectPtr()) |
| Return clone of this object. More... | |
| virtual int32_t | hashCode () |
| Return hash code for this object. More... | |
| virtual bool | equals (const LuceneObjectPtr &other) |
| Return whether two objects are equal. More... | |
| virtual int32_t | compareTo (const LuceneObjectPtr &other) |
| Compare two objects. More... | |
| virtual String | toString () |
| Returns a string representation of the object. More... | |
Public Member Functions inherited from Lucene::LuceneSync | |
| virtual | ~LuceneSync () |
| virtual SynchronizePtr | getSync () |
| Return this object synchronize lock. More... | |
| virtual LuceneSignalPtr | getSignal () |
| Return this object signal. More... | |
| virtual void | lock (int32_t timeout=0) |
| Lock this object using an optional timeout. More... | |
| virtual void | unlock () |
| Unlock this object. More... | |
| virtual bool | holdsLock () |
| Returns true if this object is currently locked by current thread. More... | |
| virtual void | wait (int32_t timeout=0) |
| Wait for signal using an optional timeout. More... | |
| virtual void | notifyAll () |
| Notify all threads waiting for signal. More... | |
Static Public Member Functions | |
| static String | _getClassName () |
Static Public Member Functions inherited from Lucene::Query | |
| static String | _getClassName () |
| static QueryPtr | mergeBooleanQueries (Collection< BooleanQueryPtr > queries) |
| Merges the clauses of a set of BooleanQuery's into a single BooleanQuery. More... | |
Protected Member Functions | |
| void | ConstructQuery (const QueryPtr &subQuery, Collection< ValueSourceQueryPtr > valSrcQueries) |
| virtual CustomScoreProviderPtr | getCustomScoreProvider (const IndexReaderPtr &reader) |
Returns a CustomScoreProvider that calculates the custom scores for the given IndexReader. The default implementation returns a default implementation as specified in the docs of CustomScoreProvider. More... | |
Protected Member Functions inherited from Lucene::LuceneObject | |
| LuceneObject () | |
Protected Attributes | |
| QueryPtr | subQuery |
| Collection< ValueSourceQueryPtr > | valSrcQueries |
| bool | strict |
Protected Attributes inherited from Lucene::Query | |
| double | boost |
Protected Attributes inherited from Lucene::LuceneSync | |
| SynchronizePtr | objectLock |
| LuceneSignalPtr | objectSignal |
Query that sets document score as a programmatic function of several (sub) scores:
FieldScoreQuery Subclasses can modify the computation by overriding getCustomScoreProvider.
| Lucene::CustomScoreQuery::CustomScoreQuery | ( | const QueryPtr & | subQuery | ) |
Create a CustomScoreQuery over input subQuery.
| subQuery | the sub query whose scored is being customed. Must not be null. |
| Lucene::CustomScoreQuery::CustomScoreQuery | ( | const QueryPtr & | subQuery, |
| const ValueSourceQueryPtr & | valSrcQuery | ||
| ) |
Create a CustomScoreQuery over input subQuery and a ValueSourceQuery.
| subQuery | the sub query whose score is being customized. Must not be null. |
| valSrcQuery | a value source query whose scores are used in the custom score computation. For most simple/convenient use case this would be a FieldScoreQuery. This parameter is optional - it can be null. |
| Lucene::CustomScoreQuery::CustomScoreQuery | ( | const QueryPtr & | subQuery, |
| Collection< ValueSourceQueryPtr > | valSrcQueries | ||
| ) |
Create a CustomScoreQuery over input subQuery and a ValueSourceQuery.
| subQuery | the sub query whose score is being customized. Must not be null. |
| valSrcQueries | value source queries whose scores are used in the custom score computation. For most simple/convenient use case these would be FieldScoreQueries. This parameter is optional - it can be null or even an empty array. |
|
virtual |
|
inlinestatic |
|
virtual |
Returns a clone of this query.
Reimplemented from Lucene::Query.
|
protected |
|
virtual |
Constructs an appropriate Weight implementation for this query. Only implemented by primitive queries, which re-write to themselves.
Reimplemented from Lucene::Query.
|
virtual |
Explain the custom score.
Deprecated: Will be removed in Lucene 3.1.
The doc is relative to the current reader, which is unknown to CustomScoreQuery when using per-segment search (since Lucene 2.9). Please override getCustomScoreProvider and return a subclass of CustomScoreProvider for the given IndexReader.
|
virtual |
Explain the custom score.
Deprecated Will be removed in Lucene 3.1.
The doc is relative to the current reader, which is unknown to CustomScoreQuery when using per-segment search (since Lucene 2.9). Please override getCustomScoreProvider and return a subclass of CustomScoreProvider for the given IndexReader.
|
virtual |
Compute a custom score by the subQuery score and a number of ValueSourceQuery scores.
Deprecated: Will be removed in Lucene 3.1.
The doc is relative to the current reader, which is unknown to CustomScoreQuery when using per-segment search (since Lucene 2.9). Please override getCustomScoreProvider and return a subclass of CustomScoreProvider for the given IndexReader.
|
virtual |
Compute a custom score by the subQuery score and the ValueSourceQuery score.
Deprecated: Will be removed in Lucene 3.1.
The doc is relative to the current reader, which is unknown to CustomScoreQuery when using per-segment search (since Lucene 2.9). Please override getCustomScoreProvider and return a subclass of CustomScoreProvider for the given IndexReader.
|
virtual |
Return whether two objects are equal.
Reimplemented from Lucene::Query.
|
virtual |
Adds all terms occurring in this query to the terms set. Only works if this query is in its rewritten form.
Reimplemented from Lucene::Query.
|
inlinevirtual |
Reimplemented from Lucene::Query.
|
protectedvirtual |
Returns a CustomScoreProvider that calculates the custom scores for the given IndexReader. The default implementation returns a default implementation as specified in the docs of CustomScoreProvider.
|
virtual |
Return hash code for this object.
Reimplemented from Lucene::Query.
|
virtual |
Checks if this is strict custom scoring. In strict custom scoring, the ValueSource part does not participate in weight normalization. This may be useful when one wants full control over how scores are modified, and does not care about normalizing by the ValueSource part. One particular case where this is useful if for testing this query.
Note: only has effect when the ValueSource part is not null.
|
virtual |
A short name of this query, used in toString(String).
|
virtual |
Called to re-write queries into primitive queries. For example, a PrefixQuery will be rewritten into a BooleanQuery that consists of TermQuerys.
Reimplemented from Lucene::Query.
|
virtual |
|
inline |
|
virtual |
Prints a query to a string.
Reimplemented from Lucene::Query.
|
virtual |
Prints a query to a string, with field assumed to be the default field and omitted.
The representation used is one that is supposed to be readable by QueryParser. However, there are the following limitations:
If the query was created by the parser, the printed representation may not be exactly what was parsed. For example, characters that need to be escaped will be represented without the required backslash.
Some of the more complicated queries (eg. span queries) don't have a representation that can be parsed by QueryParser.
Reimplemented from Lucene::Query.
|
virtual |
Prints a query to a string, with field assumed to be the default field and omitted.
The representation used is one that is supposed to be readable by QueryParser. However, there are the following limitations:
If the query was created by the parser, the printed representation may not be exactly what was parsed. For example, characters that need to be escaped will be represented without the required backslash.
Some of the more complicated queries (eg. span queries) don't have a representation that can be parsed by QueryParser.
Reimplemented from Lucene::Query.
|
protected |
|
protected |
|
protected |