public final class Passage
extends java.lang.Object
A passage contains getNumMatches()
highlights from the query,
and the offsets and query terms that correspond with each match.
Modifier and Type | Field and Description |
---|---|
(package private) int |
endOffset |
(package private) int[] |
matchEnds |
(package private) int[] |
matchStarts |
(package private) BytesRef[] |
matchTerms |
(package private) int |
numMatches |
(package private) float |
score |
(package private) int |
startOffset |
Constructor and Description |
---|
Passage() |
Modifier and Type | Method and Description |
---|---|
(package private) void |
addMatch(int startOffset,
int endOffset,
BytesRef term) |
int |
getEndOffset()
End offset of this passage.
|
int[] |
getMatchEnds()
End offsets of the term matches, corresponding with
getMatchStarts() . |
int[] |
getMatchStarts()
Start offsets of the term matches, in increasing order.
|
BytesRef[] |
getMatchTerms()
BytesRef (term text) of the matches, corresponding with
getMatchStarts() . |
int |
getNumMatches()
|
float |
getScore()
Passage's score.
|
int |
getStartOffset()
Start offset of this passage.
|
(package private) void |
reset() |
(package private) void |
sort() |
int startOffset
int endOffset
float score
int[] matchStarts
int[] matchEnds
BytesRef[] matchTerms
int numMatches
void addMatch(int startOffset, int endOffset, BytesRef term)
void sort()
void reset()
public int getStartOffset()
public int getEndOffset()
getStartOffset()
public float getScore()
public int getNumMatches()
public int[] getMatchStarts()
Only getNumMatches()
are valid. Note that these
offsets are absolute (not relative to getStartOffset()
).
public int[] getMatchEnds()
getMatchStarts()
.
Only getNumMatches()
are valid. Note that it's possible that an end offset
could exceed beyond the bounds of the passage (getEndOffset()
), if the
Analyzer produced a term which spans a passage boundary.
public BytesRef[] getMatchTerms()
getMatchStarts()
.
Only getNumMatches()
are valid.