public abstract class SpanWeight extends Weight
Modifier and Type | Class and Description |
---|---|
static class |
SpanWeight.Postings
Enumeration defining what postings information should be retrieved from the
index for a given Spans
|
Weight.DefaultBulkScorer
Modifier and Type | Field and Description |
---|---|
protected String |
field |
protected Similarity |
similarity |
protected Similarity.SimScorer |
simScorer |
parentQuery
Constructor and Description |
---|
SpanWeight(SpanQuery query,
IndexSearcher searcher,
Map<Term,TermStates> termStates,
float boost)
Create a new SpanWeight
|
Modifier and Type | Method and Description |
---|---|
Explanation |
explain(LeafReaderContext context,
int doc)
An explanation of the score computation for the named document.
|
abstract void |
extractTermStates(Map<Term,TermStates> contexts)
Collect all TermStates used by this Weight
|
LeafSimScorer |
getSimScorer(LeafReaderContext context)
Return a LeafSimScorer for this context
|
abstract Spans |
getSpans(LeafReaderContext ctx,
SpanWeight.Postings requiredPostings)
Expert: Return a Spans object iterating over matches from this Weight
|
Matches |
matches(LeafReaderContext context,
int doc)
Returns
Matches for a specific document, or null if the document
does not match the parent query
A query match that contains no position information (for example, a Point or
DocValues query) will return MatchesUtils.MATCH_WITH_NO_TERMS |
SpanScorer |
scorer(LeafReaderContext context)
Returns a
Scorer which can iterate in order over all matching
documents and assign them a score. |
bulkScorer, extractTerms, getQuery, scorerSupplier
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
isCacheable
protected final Similarity similarity
protected final Similarity.SimScorer simScorer
protected final String field
public SpanWeight(SpanQuery query, IndexSearcher searcher, Map<Term,TermStates> termStates, float boost) throws IOException
query
- the parent querysearcher
- the IndexSearcher to query againsttermStates
- a map of terms to TermStates
for use in building the similarity. May
be null if scores are not requiredIOException
- on errorpublic abstract void extractTermStates(Map<Term,TermStates> contexts)
contexts
- a map to add the TermStates topublic abstract Spans getSpans(LeafReaderContext ctx, SpanWeight.Postings requiredPostings) throws IOException
ctx
- a LeafReaderContext for this SpansIOException
- on errorpublic SpanScorer scorer(LeafReaderContext context) throws IOException
Weight
Scorer
which can iterate in order over all matching
documents and assign them a score.
NOTE: null can be returned if no documents will be scored by this query.
NOTE: The returned Scorer
does not have
LeafReader.getLiveDocs()
applied, they need to be checked on top.
scorer
in class Weight
context
- the LeafReaderContext
for which to return the Scorer
.Scorer
which scores documents in/out-of order.IOException
- if there is a low-level I/O errorpublic LeafSimScorer getSimScorer(LeafReaderContext context) throws IOException
context
- the LeafReaderContextIOException
- on errorpublic Explanation explain(LeafReaderContext context, int doc) throws IOException
Weight
explain
in class Weight
context
- the readers context to create the Explanation
for.doc
- the document's id relative to the given context's readerIOException
- if an IOException
occurspublic Matches matches(LeafReaderContext context, int doc) throws IOException
Weight
Matches
for a specific document, or null
if the document
does not match the parent query
A query match that contains no position information (for example, a Point or
DocValues query) will return MatchesUtils.MATCH_WITH_NO_TERMS
matches
in class Weight
context
- the reader's context to create the Matches
fordoc
- the document's id relative to the given context's readerIOException
Copyright © 2000-2024 Apache Software Foundation. All Rights Reserved.