Enum RewriteMethod
- All Implemented Interfaces:
Serializable
,Comparable<RewriteMethod>
- How Lucene calculates the relevance scores for each matching document
- Whether Lucene changes the original query to a bool query or bit set
- If changed to a bool query, which term query clauses are included
For more details on rewrite methods, and in particular which options are allowed, see the backend specific documentation, e.g. Elasticsearch rewrite parameters page, OpenSearch query string parameters table or Lucene MultiTermQuery.
-
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionA rewrite method that first creates a private Filter, by visiting each term in sequence and marking all docs for that term.LikeSCORING_BOOLEAN
except scores are not computed.A rewrite method that first translates each term into a should clause of a boolean query, and keeps the scores as computed by the query.A rewrite method that first translates each term into a should clause of a boolean query, but adjusts the frequencies used for scoring to be blended across the terms, otherwise the rarest term typically ranks highest (often not useful e.g.A rewrite method that first translates each term into a should clause in a boolean query, but the scores are only computed as the boost.A rewrite method that first translates each term into a should clause in a boolean query, and keeps the scores as computed by the query. -
Method Summary
Modifier and TypeMethodDescriptionstatic RewriteMethod
Returns the enum constant of this type with the specified name.static RewriteMethod[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
CONSTANT_SCORE
A rewrite method that first creates a private Filter, by visiting each term in sequence and marking all docs for that term. Matching documents are assigned a constant score equal to the query's boost.This method is faster than the BooleanQuery rewrite methods when the number of matched terms or matched documents is non-trivial. Also, it will never hit a
TooManyClauses
exception.Can only be used with
QueryStringPredicateOptionsStep.rewriteMethod(RewriteMethod)
. -
CONSTANT_SCORE_BOOLEAN
LikeSCORING_BOOLEAN
except scores are not computed. Instead, each matching document receives a constant score equal to the query's boost.This rewrite method can hit
TooManyClauses
exception.Can only be used with
QueryStringPredicateOptionsStep.rewriteMethod(RewriteMethod)
. -
SCORING_BOOLEAN
A rewrite method that first translates each term into a should clause of a boolean query, and keeps the scores as computed by the query. Note that typically such scores are meaningless to the user, and require non-trivial CPU to compute, so it's almost always better to useCONSTANT_SCORE
instead.This rewrite method can hit
TooManyClauses
exception.Can only be used with
QueryStringPredicateOptionsStep.rewriteMethod(RewriteMethod)
. -
TOP_TERMS_BLENDED_FREQS_N
A rewrite method that first translates each term into a should clause of a boolean query, but adjusts the frequencies used for scoring to be blended across the terms, otherwise the rarest term typically ranks highest (often not useful e.g. in the set of expanded terms in a fuzzy query).This rewrite method only uses the top scoring terms, so it will not overflow the boolean max clause count.
Can only be used with
QueryStringPredicateOptionsStep.rewriteMethod(RewriteMethod, int)
. -
TOP_TERMS_BOOST_N
A rewrite method that first translates each term into a should clause in a boolean query, but the scores are only computed as the boost.This rewrite method only uses the top scoring terms, so it will not overflow the boolean max clause count.
Can only be used with
QueryStringPredicateOptionsStep.rewriteMethod(RewriteMethod, int)
. -
TOP_TERMS_N
A rewrite method that first translates each term into a should clause in a boolean query, and keeps the scores as computed by the query.This rewrite method only uses the top scoring terms, so it will not overflow the boolean max clause count.
Can only be used with
QueryStringPredicateOptionsStep.rewriteMethod(RewriteMethod, int)
.
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-