java.lang.Object
org.apache.lucene.search.MultiTermQuery.RewriteMethod
org.apache.lucene.search.TermCollectingRewrite<B>
org.apache.lucene.search.ScoringRewrite<B>
Base rewrite method that translates each term into a query, and keeps the scores as computed by
the query.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) final class(package private) static final classSpecial implementation of BytesStartArray that keeps parallel arrays for boost and docFreqNested classes/interfaces inherited from class org.apache.lucene.search.TermCollectingRewrite
TermCollectingRewrite.TermCollector -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final MultiTermQuery.RewriteMethodLikeSCORING_BOOLEAN_REWRITEexcept scores are not computed.static final ScoringRewrite<BooleanQuery.Builder> A rewrite method that first translates each term intoBooleanClause.Occur.SHOULDclause in a BooleanQuery, and keeps the scores as computed by the query. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidcheckMaxClauseCount(int count) This method is called after every new term to check if the number of max clauses (e.g.final Queryrewrite(IndexReader reader, MultiTermQuery query) Methods inherited from class org.apache.lucene.search.TermCollectingRewrite
addClause, addClause, build, collectTerms, getTopLevelBuilderMethods inherited from class org.apache.lucene.search.MultiTermQuery.RewriteMethod
getTermsEnum
-
Field Details
-
SCORING_BOOLEAN_REWRITE
A rewrite method that first translates each term intoBooleanClause.Occur.SHOULDclause 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 useMultiTermQuery.CONSTANT_SCORE_BLENDED_REWRITEorMultiTermQuery.CONSTANT_SCORE_REWRITEinstead.NOTE: This rewrite method will hit
IndexSearcher.TooManyClausesif the number of terms exceedsIndexSearcher.getMaxClauseCount(). -
CONSTANT_SCORE_BOOLEAN_REWRITE
LikeSCORING_BOOLEAN_REWRITEexcept scores are not computed. Instead, each matching document receives a constant score equal to the query's boost.NOTE: This rewrite method will hit
IndexSearcher.TooManyClausesif the number of terms exceedsIndexSearcher.getMaxClauseCount().
-
-
Constructor Details
-
ScoringRewrite
public ScoringRewrite()
-
-
Method Details
-
checkMaxClauseCount
This method is called after every new term to check if the number of max clauses (e.g. in BooleanQuery) is not exceeded. Throws the correspondingRuntimeException.- Throws:
IOException
-
rewrite
- Specified by:
rewritein classMultiTermQuery.RewriteMethod- Throws:
IOException
-