- java.lang.Object
-
- org.apache.lucene.search.MultiTermQuery.RewriteMethod
-
- org.apache.lucene.search.TermCollectingRewrite<B>
-
- org.apache.lucene.search.ScoringRewrite<B>
-
public abstract class ScoringRewrite<B> extends TermCollectingRewrite<B>
Base rewrite method that translates each term into a query, and keeps the scores as computed by the query.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) class
ScoringRewrite.ParallelArraysTermCollector
(package private) static class
ScoringRewrite.TermFreqBoostByteStart
Special implementation of BytesStartArray that keeps parallel arrays for boost and docFreq-
Nested classes/interfaces inherited from class org.apache.lucene.search.TermCollectingRewrite
TermCollectingRewrite.TermCollector
-
-
Field Summary
Fields Modifier and Type Field Description static MultiTermQuery.RewriteMethod
CONSTANT_SCORE_BOOLEAN_REWRITE
LikeSCORING_BOOLEAN_REWRITE
except scores are not computed.static ScoringRewrite<BooleanQuery.Builder>
SCORING_BOOLEAN_REWRITE
A rewrite method that first translates each term intoBooleanClause.Occur.SHOULD
clause in a BooleanQuery, and keeps the scores as computed by the query.
-
Constructor Summary
Constructors Constructor Description ScoringRewrite()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract void
checkMaxClauseCount(int count)
This method is called after every new term to check if the number of max clauses (e.g.Query
rewrite(IndexReader reader, MultiTermQuery query)
-
Methods inherited from class org.apache.lucene.search.TermCollectingRewrite
addClause, addClause, build, collectTerms, getTopLevelBuilder
-
Methods inherited from class org.apache.lucene.search.MultiTermQuery.RewriteMethod
getTermsEnum
-
-
-
-
Field Detail
-
SCORING_BOOLEAN_REWRITE
public static final ScoringRewrite<BooleanQuery.Builder> SCORING_BOOLEAN_REWRITE
A rewrite method that first translates each term intoBooleanClause.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 useMultiTermQuery.CONSTANT_SCORE_BLENDED_REWRITE
orMultiTermQuery.CONSTANT_SCORE_REWRITE
instead.NOTE: This rewrite method will hit
IndexSearcher.TooManyClauses
if the number of terms exceedsIndexSearcher.getMaxClauseCount()
.
-
CONSTANT_SCORE_BOOLEAN_REWRITE
public static final MultiTermQuery.RewriteMethod CONSTANT_SCORE_BOOLEAN_REWRITE
LikeSCORING_BOOLEAN_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
IndexSearcher.TooManyClauses
if the number of terms exceedsIndexSearcher.getMaxClauseCount()
.
-
-
Method Detail
-
checkMaxClauseCount
protected abstract void checkMaxClauseCount(int count) throws java.io.IOException
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:
java.io.IOException
-
rewrite
public final Query rewrite(IndexReader reader, MultiTermQuery query) throws java.io.IOException
- Specified by:
rewrite
in classMultiTermQuery.RewriteMethod
- Throws:
java.io.IOException
-
-