Package org.apache.lucene.search
Class MultiTermQuery.TopTermsBoostOnlyBooleanQueryRewrite
- java.lang.Object
-
- org.apache.lucene.search.MultiTermQuery.RewriteMethod
-
- org.apache.lucene.search.TopTermsRewrite<BooleanQuery.Builder>
-
- org.apache.lucene.search.MultiTermQuery.TopTermsBoostOnlyBooleanQueryRewrite
-
- Enclosing class:
- MultiTermQuery
public static final class MultiTermQuery.TopTermsBoostOnlyBooleanQueryRewrite extends TopTermsRewrite<BooleanQuery.Builder>
A rewrite method that first translates each term intoBooleanClause.Occur.SHOULDclause 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
Constructors Constructor Description TopTermsBoostOnlyBooleanQueryRewrite(int size)Create a TopTermsBoostOnlyBooleanQueryRewrite for at mostsizeterms.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddClause(B topLevel, Term term, int docCount, float boost)Add a MultiTermQuery term to the top-level query builder.protected voidaddClause(BooleanQuery.Builder topLevel, Term term, int docFreq, float boost, TermStates states)protected Querybuild(BooleanQuery.Builder builder)Finalize the creation of the query from the builder.protected intgetMaxSize()return the maximum size of the priority queue (for boolean rewrites this is BooleanQuery#getMaxClauseCount).protected BooleanQuery.BuildergetTopLevelBuilder()Return a suitable builder for the 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
-
TopTermsBoostOnlyBooleanQueryRewrite
public TopTermsBoostOnlyBooleanQueryRewrite(int size)
Create a TopTermsBoostOnlyBooleanQueryRewrite for at mostsizeterms.NOTE: if
IndexSearcher.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.Builder>
-
getTopLevelBuilder
protected BooleanQuery.Builder getTopLevelBuilder()
Return a suitable builder for the top-level Query for holding all expanded terms.
-
build
protected Query build(BooleanQuery.Builder builder)
Finalize the creation of the query from the builder.
-
addClause
protected void addClause(BooleanQuery.Builder topLevel, Term term, int docFreq, float boost, TermStates states)
-
addClause
protected final void addClause(B topLevel, Term term, int docCount, float boost) throws IOExceptionAdd a MultiTermQuery term to the top-level query builder.- Throws:
IOException
-
-