Module org.apache.lucene.core
Package org.apache.lucene.search
Class AbstractMultiTermQueryConstantScoreWrapper.RewritingWeight
java.lang.Object
org.apache.lucene.search.Weight
org.apache.lucene.search.ConstantScoreWeight
org.apache.lucene.search.AbstractMultiTermQueryConstantScoreWrapper.RewritingWeight
- All Implemented Interfaces:
SegmentCacheable
- Enclosing class:
AbstractMultiTermQueryConstantScoreWrapper<Q extends MultiTermQuery>
protected abstract static class AbstractMultiTermQueryConstantScoreWrapper.RewritingWeight
extends ConstantScoreWeight
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.lucene.search.Weight
Weight.DefaultBulkScorer, Weight.DefaultScorerSupplier -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final MultiTermQueryprivate final ScoreModeprivate final IndexSearcherFields inherited from class org.apache.lucene.search.Weight
parentQuery -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedRewritingWeight(MultiTermQuery q, float boost, ScoreMode scoreMode, IndexSearcher searcher) -
Method Summary
Modifier and TypeMethodDescriptionprivate booleancollectTerms(int fieldDocCount, TermsEnum termsEnum, List<AbstractMultiTermQueryConstantScoreWrapper.TermAndState> terms) private static longestimateCost(Terms terms, long queryTermsCount) booleanmatches(LeafReaderContext context, int doc) ReturnsMatchesfor a specific document, ornullif the document does not match the parent queryrewriteAsBooleanQuery(LeafReaderContext context, List<AbstractMultiTermQueryConstantScoreWrapper.TermAndState> collectedTerms) protected abstract AbstractMultiTermQueryConstantScoreWrapper.WeightOrDocIdSetIteratorrewriteInner(LeafReaderContext context, int fieldDocCount, Terms terms, TermsEnum termsEnum, List<AbstractMultiTermQueryConstantScoreWrapper.TermAndState> collectedTerms) Rewrite the query as either aWeightor aDocIdSetIteratorwrapped in aAbstractMultiTermQueryConstantScoreWrapper.WeightOrDocIdSetIterator.private ScorerscorerForIterator(DocIdSetIterator iterator) scorerSupplier(LeafReaderContext context) Get aScorerSupplier, which allows knowing the cost of theScorerbefore building it.Methods inherited from class org.apache.lucene.search.ConstantScoreWeight
explain, scoreMethods inherited from class org.apache.lucene.search.Weight
bulkScorer, count, getQuery, scorer
-
Field Details
-
q
-
scoreMode
-
searcher
-
-
Constructor Details
-
RewritingWeight
protected RewritingWeight(MultiTermQuery q, float boost, ScoreMode scoreMode, IndexSearcher searcher)
-
-
Method Details
-
rewriteInner
protected abstract AbstractMultiTermQueryConstantScoreWrapper.WeightOrDocIdSetIterator rewriteInner(LeafReaderContext context, int fieldDocCount, Terms terms, TermsEnum termsEnum, List<AbstractMultiTermQueryConstantScoreWrapper.TermAndState> collectedTerms) throws IOException Rewrite the query as either aWeightor aDocIdSetIteratorwrapped in aAbstractMultiTermQueryConstantScoreWrapper.WeightOrDocIdSetIterator. Before this is called, the weight will attempt to "collect" found terms up to a threshold. If fewer terms than the threshold are found, the query will simply be rewritten into aBooleanQueryand this method will not be called. This will only be called if it is determined there are more found terms. At the point this method is invoked,termsEnumwill be positioned on the next "uncollected" term. The terms that were already collected will be incollectedTerms.- Throws:
IOException
-
rewriteAsBooleanQuery
private AbstractMultiTermQueryConstantScoreWrapper.WeightOrDocIdSetIterator rewriteAsBooleanQuery(LeafReaderContext context, List<AbstractMultiTermQueryConstantScoreWrapper.TermAndState> collectedTerms) throws IOException - Throws:
IOException
-
collectTerms
private boolean collectTerms(int fieldDocCount, TermsEnum termsEnum, List<AbstractMultiTermQueryConstantScoreWrapper.TermAndState> terms) throws IOException - Throws:
IOException
-
scorerForIterator
-
matches
Description copied from class:WeightReturnsMatchesfor a specific document, ornullif the document does not match the parent queryA query match that contains no position information (for example, a Point or DocValues query) will return
MatchesUtils.MATCH_WITH_NO_TERMS- Overrides:
matchesin classWeight- Parameters:
context- the reader's context to create theMatchesfordoc- the document's id relative to the given context's reader- Throws:
IOException
-
scorerSupplier
Description copied from class:WeightGet aScorerSupplier, which allows knowing the cost of theScorerbefore building it. A scorer supplier for the sameLeafReaderContextinstance may be requested multiple times as part of a single search call.Note: It must return null if the scorer is null.
- Specified by:
scorerSupplierin classWeight- Parameters:
context- the leaf reader context- Returns:
- a
ScorerSupplierproviding the scorer, or null if scorer is null - Throws:
IOException- if an IOException occurs- See Also:
-
estimateCost
- Throws:
IOException
-
isCacheable
- Returns:
trueif the object can be cached against a given leaf
-