public static final class MultiTermQuery.TopTermsBlendedFreqScoringRewrite extends TopTermsRewrite<BlendedTermQuery.Builder>
BooleanClause.Occur.SHOULD
clause in a BooleanQuery, but adjusts
the frequencies used for scoring to be blended across the terms, otherwise
the rarest term typically ranks highest (often not useful eg in the set of
expanded terms in a FuzzyQuery).
This rewrite method only uses the top scoring terms so it will not overflow the boolean max clause count.
Constructor and Description |
---|
TopTermsBlendedFreqScoringRewrite(int size)
Create a TopTermsBlendedScoringBooleanQueryRewrite for at most
size terms. |
Modifier and Type | Method and Description |
---|---|
protected void |
addClause(BlendedTermQuery.Builder topLevel,
Term term,
int docCount,
float boost,
TermStates states) |
protected void |
addClause(B topLevel,
Term term,
int docCount,
float boost)
Add a MultiTermQuery term to the top-level query builder.
|
protected Query |
build(BlendedTermQuery.Builder builder)
Finalize the creation of the query from the builder.
|
protected int |
getMaxSize()
return the maximum size of the priority queue (for boolean rewrites this is BooleanQuery#getMaxClauseCount).
|
protected BlendedTermQuery.Builder |
getTopLevelBuilder()
Return a suitable builder for the top-level Query for holding all expanded terms.
|
equals, getSize, hashCode, rewrite
getTermsEnum
public TopTermsBlendedFreqScoringRewrite(int size)
size
terms.
NOTE: if BooleanQuery.getMaxClauseCount()
is smaller than
size
, then it will be used instead.
protected int getMaxSize()
TopTermsRewrite
getMaxSize
in class TopTermsRewrite<BlendedTermQuery.Builder>
protected BlendedTermQuery.Builder getTopLevelBuilder()
protected Query build(BlendedTermQuery.Builder builder)
protected void addClause(BlendedTermQuery.Builder topLevel, Term term, int docCount, float boost, TermStates states)
protected final void addClause(B topLevel, Term term, int docCount, float boost) throws IOException
IOException
Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.