public abstract class

ScoringRewrite

extends MultiTermQuery.RewriteMethod
java.lang.Object
   ↳ org.apache.lucene.search.MultiTermQuery.RewriteMethod
     ↳ org.apache.lucene.search.ScoringRewrite<Q extends org.apache.lucene.search.Query>

Summary

Fields
public static final MultiTermQuery.RewriteMethod CONSTANT_SCORE_BOOLEAN_QUERY_REWRITE Like SCORING_BOOLEAN_QUERY_REWRITE except scores are not computed.
public static final ScoringRewrite<BooleanQuery> SCORING_BOOLEAN_QUERY_REWRITE A rewrite method that first translates each term into SHOULD clause in a BooleanQuery, and keeps the scores as computed by the query.
Public Constructors
ScoringRewrite()
Public Methods
Q rewrite(IndexReader reader, MultiTermQuery query)
Protected Methods
abstract void addClause(Q topLevel, Term term, float boost)
Add a MultiTermQuery term to the top-level query
final void collectTerms(IndexReader reader, MultiTermQuery query, TermCollectingRewrite.TermCollector collector)
abstract Q getTopLevelQuery()
Return a suitable top-level Query for holding all expanded terms.
[Expand]
Inherited Methods
From class org.apache.lucene.search.MultiTermQuery.RewriteMethod
From class java.lang.Object

Fields

public static final MultiTermQuery.RewriteMethod CONSTANT_SCORE_BOOLEAN_QUERY_REWRITE

Like SCORING_BOOLEAN_QUERY_REWRITE except scores are not computed. Instead, each matching document receives a constant score equal to the query's boost.

NOTE: This rewrite method will hit BooleanQuery.TooManyClauses if the number of terms exceeds getMaxClauseCount().

See Also
  • #setRewriteMethod

public static final ScoringRewrite<BooleanQuery> SCORING_BOOLEAN_QUERY_REWRITE

A rewrite method that first translates each term into 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.

NOTE: This rewrite method will hit BooleanQuery.TooManyClauses if the number of terms exceeds getMaxClauseCount().

See Also
  • #setRewriteMethod

Public Constructors

public ScoringRewrite ()

Public Methods

public Q rewrite (IndexReader reader, MultiTermQuery query)

Throws
IOException

Protected Methods

protected abstract void addClause (Q topLevel, Term term, float boost)

Add a MultiTermQuery term to the top-level query

Throws
IOException

protected final void collectTerms (IndexReader reader, MultiTermQuery query, TermCollectingRewrite.TermCollector collector)

Throws
IOException

protected abstract Q getTopLevelQuery ()

Return a suitable top-level Query for holding all expanded terms.

Throws
IOException