Class ContextQuery.ContextCompletionWeight
- java.lang.Object
-
- org.apache.lucene.search.Weight
-
- org.apache.lucene.search.suggest.document.CompletionWeight
-
- org.apache.lucene.search.suggest.document.ContextQuery.ContextCompletionWeight
-
- All Implemented Interfaces:
SegmentCacheable
- Enclosing class:
- ContextQuery
private static class ContextQuery.ContextCompletionWeight extends CompletionWeight
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.lucene.search.Weight
Weight.DefaultBulkScorer, Weight.StartDISIWrapper
-
-
Field Summary
Fields Modifier and Type Field Description private int[]contextLengthsprivate java.util.Map<IntsRef,java.lang.Float>contextMapprivate floatcurrentBoostprivate java.lang.CharSequencecurrentContextprivate CompletionWeightinnerWeightprivate BytesRefBuilderscratch-
Fields inherited from class org.apache.lucene.search.Weight
parentQuery
-
-
Constructor Summary
Constructors Constructor Description ContextCompletionWeight(CompletionQuery query, Automaton automaton, CompletionWeight innerWeight, java.util.Map<IntsRef,java.lang.Float> contextMap, int[] contextLengths)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected floatboost()Returns the boost of the partial path set byCompletionWeight.setNextMatch(IntsRef)protected java.lang.CharSequencecontext()Returns the context of the partial path set byCompletionWeight.setNextMatch(IntsRef)private voidsetInnerWeight(IntsRef ref, int offset)protected voidsetNextMatch(IntsRef pathPrefix)Set for every partial path in the index that matched the query automaton.-
Methods inherited from class org.apache.lucene.search.suggest.document.CompletionWeight
bulkScorer, explain, extractTerms, getAutomaton, isCacheable, scorer
-
Methods inherited from class org.apache.lucene.search.Weight
getQuery, matches, scorerSupplier
-
-
-
-
Field Detail
-
contextMap
private final java.util.Map<IntsRef,java.lang.Float> contextMap
-
contextLengths
private final int[] contextLengths
-
innerWeight
private final CompletionWeight innerWeight
-
scratch
private final BytesRefBuilder scratch
-
currentBoost
private float currentBoost
-
currentContext
private java.lang.CharSequence currentContext
-
-
Constructor Detail
-
ContextCompletionWeight
public ContextCompletionWeight(CompletionQuery query, Automaton automaton, CompletionWeight innerWeight, java.util.Map<IntsRef,java.lang.Float> contextMap, int[] contextLengths) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
setNextMatch
protected void setNextMatch(IntsRef pathPrefix)
Description copied from class:CompletionWeightSet for every partial path in the index that matched the query automaton. Subclasses should overrideCompletionWeight.boost()andCompletionWeight.context()to return an appropriate value with respect to the current pathPrefix.- Overrides:
setNextMatchin classCompletionWeight- Parameters:
pathPrefix- the prefix of a matched path
-
setInnerWeight
private void setInnerWeight(IntsRef ref, int offset)
-
context
protected java.lang.CharSequence context()
Description copied from class:CompletionWeightReturns the context of the partial path set byCompletionWeight.setNextMatch(IntsRef)- Overrides:
contextin classCompletionWeight- Returns:
- suggestion context
-
boost
protected float boost()
Description copied from class:CompletionWeightReturns the boost of the partial path set byCompletionWeight.setNextMatch(IntsRef)- Overrides:
boostin classCompletionWeight- Returns:
- suggestion query-time boost
-
-