TokenGroup (Lucene 10.5.1 highlighter API)
Description: declaration: package: org.apache.lucene.search.highlight, class: TokenGroup

Package org.apache.lucene.search.highlight

# Class TokenGroup

java.lang.Object
org.apache.lucene.search.highlight.TokenGroup

public class TokenGroup extends Object
One, or several overlapping tokens, along with the score(s) and the scope of the original text.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `TokenGroup(TokenStream tokenStream)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `int`
  `getEndOffset()`
  `int`
  `getNumTokens()`
  `float`
  `getScore(int index)`
  `int`
  `getStartOffset()`
  `float`
  `getTotalScore()`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### TokenGroup

    public TokenGroup(TokenStream tokenStream)

- ## Method Details

  - ### 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