Package org.apache.lucene.search
Class MultiTermQuery.TopTermsScoringBooleanQueryRewrite
- java.lang.Object
-
- org.apache.lucene.search.MultiTermQuery.RewriteMethod
-
- org.apache.lucene.search.TopTermsRewrite<BooleanQuery>
-
- org.apache.lucene.search.MultiTermQuery.TopTermsScoringBooleanQueryRewrite
-
- Enclosing class:
- MultiTermQuery
public static final class MultiTermQuery.TopTermsScoringBooleanQueryRewrite extends TopTermsRewrite<BooleanQuery>
A rewrite method that first translates each term intoBooleanClause.Occur.SHOULDclause in a BooleanQuery, 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. It is the default rewrite method for
FuzzyQuery.
-
-
Constructor Summary
Constructors Constructor Description TopTermsScoringBooleanQueryRewrite(int size)Create a TopTermsScoringBooleanQueryRewrite for at mostsizeterms.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddClause(BooleanQuery topLevel, Term term, int docCount, float boost, TermContext states)protected voidaddClause(Q topLevel, Term term, int docCount, float boost)Add a MultiTermQuery term to the top-level queryprotected intgetMaxSize()return the maximum size of the priority queue (for boolean rewrites this is BooleanQuery#getMaxClauseCount).protected BooleanQuerygetTopLevelQuery()Return a suitable top-level Query for holding all expanded terms.-
Methods inherited from class org.apache.lucene.search.TopTermsRewrite
equals, getSize, hashCode, rewrite
-
Methods inherited from class org.apache.lucene.search.MultiTermQuery.RewriteMethod
getTermsEnum
-
-
-
-
Constructor Detail
-
TopTermsScoringBooleanQueryRewrite
public TopTermsScoringBooleanQueryRewrite(int size)
Create a TopTermsScoringBooleanQueryRewrite for at mostsizeterms.NOTE: if
BooleanQuery.getMaxClauseCount()is smaller thansize, then it will be used instead.
-
-
Method Detail
-
getMaxSize
protected int getMaxSize()
Description copied from class:TopTermsRewritereturn the maximum size of the priority queue (for boolean rewrites this is BooleanQuery#getMaxClauseCount).- Specified by:
getMaxSizein classTopTermsRewrite<BooleanQuery>
-
getTopLevelQuery
protected BooleanQuery getTopLevelQuery()
Return a suitable top-level Query for holding all expanded terms.
-
addClause
protected void addClause(BooleanQuery topLevel, Term term, int docCount, float boost, TermContext states)
-
addClause
protected final void addClause(Q topLevel, Term term, int docCount, float boost) throws IOExceptionAdd a MultiTermQuery term to the top-level query- Throws:
IOException
-
-