Package org.apache.lucene.search
Class MultiTermQuery.ConstantScoreAutoRewrite
- java.lang.Object
-
- org.apache.lucene.search.MultiTermQuery.RewriteMethod
-
- org.apache.lucene.search.MultiTermQuery.ConstantScoreAutoRewrite
-
- Enclosing class:
- MultiTermQuery
public static class MultiTermQuery.ConstantScoreAutoRewrite extends MultiTermQuery.RewriteMethod
A rewrite method that tries to pick the best constant-score rewrite method based on term and document counts from the query. If both the number of terms and documents is small enough, thenMultiTermQuery.CONSTANT_SCORE_BOOLEAN_QUERY_REWRITEis used. Otherwise,MultiTermQuery.CONSTANT_SCORE_FILTER_REWRITEis used.
-
-
Field Summary
Fields Modifier and Type Field Description static doubleDEFAULT_DOC_COUNT_PERCENTstatic intDEFAULT_TERM_COUNT_CUTOFF
-
Constructor Summary
Constructors Constructor Description ConstantScoreAutoRewrite()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)doublegetDocCountPercent()intgetTermCountCutoff()inthashCode()Queryrewrite(IndexReader reader, MultiTermQuery query)voidsetDocCountPercent(double percent)If the number of documents to be visited in the postings exceeds this specified percentage of the maxDoc() for the index, thenMultiTermQuery.CONSTANT_SCORE_FILTER_REWRITEis used.voidsetTermCountCutoff(int count)If the number of terms in this query is equal to or larger than this setting thenMultiTermQuery.CONSTANT_SCORE_FILTER_REWRITEis used.
-
-
-
Method Detail
-
setTermCountCutoff
public void setTermCountCutoff(int count)
If the number of terms in this query is equal to or larger than this setting thenMultiTermQuery.CONSTANT_SCORE_FILTER_REWRITEis used.
-
getTermCountCutoff
public int getTermCountCutoff()
- See Also:
setTermCountCutoff(int)
-
setDocCountPercent
public void setDocCountPercent(double percent)
If the number of documents to be visited in the postings exceeds this specified percentage of the maxDoc() for the index, thenMultiTermQuery.CONSTANT_SCORE_FILTER_REWRITEis used.- Parameters:
percent- 0.0 to 100.0
-
getDocCountPercent
public double getDocCountPercent()
- See Also:
setDocCountPercent(double)
-
rewrite
public Query rewrite(IndexReader reader, MultiTermQuery query) throws java.io.IOException
- Specified by:
rewritein classMultiTermQuery.RewriteMethod- Throws:
java.io.IOException
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
-