Field Summary

Read-only default instance of MultiTermQuery.ConstantScoreAutoRewrite, with ConstantScoreAutoRewrite.setTermCountCutoff(int) set to
ConstantScoreAutoRewrite.DEFAULT_TERM_COUNT_CUTOFF
and ConstantScoreAutoRewrite.setDocCountPercent(double) set to
ConstantScoreAutoRewrite.DEFAULT_DOC_COUNT_PERCENT.

field

rewriteMethod

CONSTANT_SCORE_FILTER_REWRITE

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 an errant BooleanQuery.TooManyClauses
exception.

SCORING_BOOLEAN_QUERY_REWRITE

A rewrite method that first translates each term into
BooleanClause.Occur.SHOULD clause in a
BooleanQuery, 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 use CONSTANT_SCORE_AUTO_REWRITE_DEFAULT instead.

CONSTANT_SCORE_AUTO_REWRITE_DEFAULT

Read-only default instance of MultiTermQuery.ConstantScoreAutoRewrite, with ConstantScoreAutoRewrite.setTermCountCutoff(int) set to
ConstantScoreAutoRewrite.DEFAULT_TERM_COUNT_CUTOFF
and ConstantScoreAutoRewrite.setDocCountPercent(double) set to
ConstantScoreAutoRewrite.DEFAULT_DOC_COUNT_PERCENT.
Note that you cannot alter the configuration of this
instance; you'll need to create a private instance
instead.

Method Detail

getField

getTermsEnum

Construct the enumeration to be used, expanding the
pattern term. This method should only be called if
the field exists (ie, implementations can assume the
field does exist). This method should not return null
(should instead return TermsEnum.EMPTY if no
terms match). The TermsEnum must already be
positioned to the first matching term.
The given AttributeSource is passed by the MultiTermQuery.RewriteMethod to
provide attributes, the rewrite method uses to inform about e.g. maximum competitive boosts.
This is currently only used by TopTermsRewrite