Class TokenGroup
- java.lang.Object
-
- org.apache.lucene.search.highlight.TokenGroup
-
public class TokenGroup extends java.lang.ObjectOne, or several overlapping tokens, along with the score(s) and the scope of the original text.
-
-
Field Summary
Fields Modifier and Type Field Description private intendOffsetprivate intmatchEndOffsetprivate intmatchStartOffsetprivate static intMAX_NUM_TOKENS_PER_GROUPprivate intnumTokensprivate OffsetAttributeoffsetAttprivate float[]scoresprivate intstartOffsetprivate CharTermAttributetermAttprivate floattot
-
Constructor Summary
Constructors Constructor Description TokenGroup(TokenStream tokenStream)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) voidaddToken(float score)(package private) voidclear()intgetEndOffset()intgetNumTokens()floatgetScore(int index)intgetStartOffset()floatgetTotalScore()(package private) booleanisDistinct()
-
-
-
Field Detail
-
MAX_NUM_TOKENS_PER_GROUP
private static final int MAX_NUM_TOKENS_PER_GROUP
- See Also:
- Constant Field Values
-
scores
private float[] scores
-
numTokens
private int numTokens
-
startOffset
private int startOffset
-
endOffset
private int endOffset
-
tot
private float tot
-
matchStartOffset
private int matchStartOffset
-
matchEndOffset
private int matchEndOffset
-
offsetAtt
private OffsetAttribute offsetAtt
-
termAtt
private CharTermAttribute termAtt
-
-
Constructor Detail
-
TokenGroup
public TokenGroup(TokenStream tokenStream)
-
-
Method Detail
-
addToken
void addToken(float score)
-
isDistinct
boolean isDistinct()
-
clear
void clear()
-
getScore
public float getScore(int index)
- Parameters:
index- a value between 0 and numTokens -1- Returns:
- the "n"th score
-
getStartOffset
public int getStartOffset()
- Returns:
- the earliest start offset in the original text of a matching token in this group (score > 0), or if there are none then the earliest offset of any token in the group.
-
getEndOffset
public int getEndOffset()
- Returns:
- the latest end offset in the original text of a matching token in this group (score > 0), or
if there are none then
getEndOffset().
-
getNumTokens
public int getNumTokens()
- Returns:
- the number of tokens in this group
-
getTotalScore
public float getTotalScore()
- Returns:
- all tokens' scores summed up
-
-