Class Passage
java.lang.Object
org.apache.lucene.search.postingshighlight.Passage
Represents a passage (typically a sentence of the document).
A passage contains getNumMatches() highlights from the query,
and the offsets and query terms that correspond with each match.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintEnd offset of this passage.int[]End offsets of the term matches, corresponding withgetMatchStarts().int[]Start offsets of the term matches, in increasing order.BytesRef[]BytesRef (term text) of the matches, corresponding withgetMatchStarts().intfloatgetScore()Passage's score.intStart offset of this passage.
-
Constructor Details
-
Passage
public Passage()
-
-
Method Details
-
getStartOffset
public int getStartOffset()Start offset of this passage.- Returns:
- start index (inclusive) of the passage in the original content: always >= 0.
-
getEndOffset
public int getEndOffset()End offset of this passage.- Returns:
- end index (exclusive) of the passage in the
original content: always >=
getStartOffset()
-
getScore
public float getScore()Passage's score. -
getNumMatches
public int getNumMatches() -
getMatchStarts
public int[] getMatchStarts()Start offsets of the term matches, in increasing order.Only
getNumMatches()are valid. Note that these offsets are absolute (not relative togetStartOffset()). -
getMatchEnds
public int[] getMatchEnds()End offsets of the term matches, corresponding withgetMatchStarts().Only
getNumMatches()are valid. Note that its 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. -
getMatchTerms
BytesRef (term text) of the matches, corresponding withgetMatchStarts().Only
getNumMatches()are valid.
-