Module org.apache.lucene.suggest
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
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.lucene.search.Weight
Weight.DefaultBulkScorer
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final int[]
private float
private CharSequence
private final CompletionWeight
private final BytesRefBuilder
Fields inherited from class org.apache.lucene.search.Weight
parentQuery
-
Constructor Summary
ConstructorsConstructorDescriptionContextCompletionWeight
(CompletionQuery query, Automaton automaton, CompletionWeight innerWeight, Map<IntsRef, Float> contextMap, int[] contextLengths) -
Method Summary
Modifier and TypeMethodDescriptionprotected float
boost()
Returns the boost of the partial path set byCompletionWeight.setNextMatch(IntsRef)
protected CharSequence
context()
Returns the context of the partial path set byCompletionWeight.setNextMatch(IntsRef)
private void
setInnerWeight
(IntsRef ref, int offset) protected void
setNextMatch
(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, getAutomaton, isCacheable, scorer
Methods inherited from class org.apache.lucene.search.Weight
count, getQuery, matches, scorerSupplier
-
Field Details
-
contextMap
-
contextLengths
private final int[] contextLengths -
innerWeight
-
scratch
-
currentBoost
private float currentBoost -
currentContext
-
-
Constructor Details
-
ContextCompletionWeight
public ContextCompletionWeight(CompletionQuery query, Automaton automaton, CompletionWeight innerWeight, Map<IntsRef, Float> contextMap, int[] contextLengths) throws IOException- Throws:
IOException
-
-
Method Details
-
setNextMatch
Description copied from class:CompletionWeight
Set for every partial path in the index that matched the query automaton.Subclasses should override
CompletionWeight.boost()
andCompletionWeight.context()
to return an appropriate value with respect to the current pathPrefix.- Overrides:
setNextMatch
in classCompletionWeight
- Parameters:
pathPrefix
- the prefix of a matched path
-
setInnerWeight
-
context
Description copied from class:CompletionWeight
Returns the context of the partial path set byCompletionWeight.setNextMatch(IntsRef)
- Overrides:
context
in classCompletionWeight
- Returns:
- suggestion context
-
boost
protected float boost()Description copied from class:CompletionWeight
Returns the boost of the partial path set byCompletionWeight.setNextMatch(IntsRef)
- Overrides:
boost
in classCompletionWeight
- Returns:
- suggestion query-time boost
-