Package org.apache.lucene.search
Class MultiTermQuery.TopTermsBoostOnlyBooleanQueryRewrite
java.lang.Object
org.apache.lucene.search.MultiTermQuery.RewriteMethod
org.apache.lucene.search.TopTermsRewrite<BooleanQuery>
org.apache.lucene.search.MultiTermQuery.TopTermsBoostOnlyBooleanQueryRewrite
- Enclosing class:
- MultiTermQuery
public static final class MultiTermQuery.TopTermsBoostOnlyBooleanQueryRewrite
extends TopTermsRewrite<BooleanQuery>
A rewrite method that first translates each term into
BooleanClause.Occur.SHOULD clause in a BooleanQuery, but the scores
are only computed as the boost.
This rewrite method only uses the top scoring terms so it will not overflow the boolean max clause count.
-
Constructor Summary
ConstructorsConstructorDescriptionTopTermsBoostOnlyBooleanQueryRewrite(int size) Create a TopTermsBoostOnlyBooleanQueryRewrite for at mostsizeterms. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddClause(BooleanQuery topLevel, Term term, int docFreq, float boost, TermContext states) protected final voidaddClause(BooleanQuery topLevel, Term term, int docCount, float boost) Add a MultiTermQuery term to the top-level queryprotected intreturn the maximum size of the priority queue (for boolean rewrites this is BooleanQuery#getMaxClauseCount).protected BooleanQueryReturn a suitable top-level Query for holding all expanded terms.Methods inherited from class org.apache.lucene.search.TopTermsRewrite
equals, getSize, hashCode, rewriteMethods inherited from class org.apache.lucene.search.MultiTermQuery.RewriteMethod
getTermsEnum
-
Constructor Details
-
TopTermsBoostOnlyBooleanQueryRewrite
public TopTermsBoostOnlyBooleanQueryRewrite(int size) Create a TopTermsBoostOnlyBooleanQueryRewrite for at mostsizeterms.NOTE: if
BooleanQuery.getMaxClauseCount()is smaller thansize, then it will be used instead.
-
-
Method Details
-
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
Return a suitable top-level Query for holding all expanded terms. -
addClause
protected void addClause(BooleanQuery topLevel, Term term, int docFreq, float boost, TermContext states) -
addClause
protected final void addClause(BooleanQuery topLevel, Term term, int docCount, float boost) throws IOException Add a MultiTermQuery term to the top-level query- Throws:
IOException
-