Package org.apache.lucene.search
Class TopTermsRewrite<B>
java.lang.Object
org.apache.lucene.search.MultiTermQuery.RewriteMethod
org.apache.lucene.search.TopTermsRewrite<B>
- Direct Known Subclasses:
MultiTermQuery.TopTermsBlendedFreqScoringRewrite
,MultiTermQuery.TopTermsBoostOnlyBooleanQueryRewrite
,MultiTermQuery.TopTermsScoringBooleanQueryRewrite
Base rewrite method for collecting only the top terms via a priority queue.
- NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.
- Only public to be accessible by spans package.
-
Constructor Summary
ConstructorDescriptionTopTermsRewrite
(int size) Create a TopTermsBooleanQueryRewrite for at mostsize
terms. -
Method Summary
Modifier and TypeMethodDescriptionprotected final void
Add a MultiTermQuery term to the top-level query builder.protected abstract void
addClause
(B topLevel, Term term, int docCount, float boost, TermStates states) protected abstract Query
Finalize the creation of the query from the builder.boolean
protected abstract int
return the maximum size of the priority queue (for boolean rewrites this is BooleanQuery#getMaxClauseCount).int
getSize()
return the maximum priority queue sizeprotected abstract B
Return a suitable builder for the top-level Query for holding all expanded terms.int
hashCode()
final Query
rewrite
(IndexReader reader, MultiTermQuery query) Methods inherited from class org.apache.lucene.search.MultiTermQuery.RewriteMethod
getTermsEnum
-
Constructor Details
-
TopTermsRewrite
public TopTermsRewrite(int size) Create a TopTermsBooleanQueryRewrite for at mostsize
terms.NOTE: if
IndexSearcher.getMaxClauseCount()
is smaller thansize
, then it will be used instead.
-
-
Method Details
-
getSize
public int getSize()return the maximum priority queue size -
getMaxSize
protected abstract int getMaxSize()return the maximum size of the priority queue (for boolean rewrites this is BooleanQuery#getMaxClauseCount). -
rewrite
- Specified by:
rewrite
in classMultiTermQuery.RewriteMethod
- Throws:
IOException
-
hashCode
public int hashCode() -
equals
-
getTopLevelBuilder
Return a suitable builder for the top-level Query for holding all expanded terms.- Throws:
IOException
-
build
Finalize the creation of the query from the builder. -
addClause
Add a MultiTermQuery term to the top-level query builder.- Throws:
IOException
-
addClause
protected abstract void addClause(B topLevel, Term term, int docCount, float boost, TermStates states) throws IOException - Throws:
IOException
-