org.apache.lucene.search.uhighlight

## Class TokenStreamOffsetStrategy

- java.lang.Object
- - org.apache.lucene.search.uhighlight.FieldOffsetStrategy
  - - org.apache.lucene.search.uhighlight.AnalysisOffsetStrategy
    - - org.apache.lucene.search.uhighlight.TokenStreamOffsetStrategy

-     public class TokenStreamOffsetStrategy
      extends AnalysisOffsetStrategy

  Analyzes the text, producing a single `OffsetsEnum` wrapping the `TokenStream` filtered to terms in the query, including wildcards. It can't handle position-sensitive queries (phrases). Passage accuracy suffers because the freq() is unknown -- it's always `Integer.MAX_VALUE` instead.

- - ### Field Summary

    - ### Fields inherited from class org.apache.lucene.search.uhighlight.AnalysisOffsetStrategy

      `analyzer`

    - ### Fields inherited from class org.apache.lucene.search.uhighlight.FieldOffsetStrategy

      `automata, field, phraseHelper, terms`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TokenStreamOffsetStrategy(String field, BytesRef[] terms, PhraseHelper phraseHelper, CharacterRunAutomaton[] automata, Analyzer indexAnalyzer)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `OffsetsEnum` | `getOffsetsEnum(IndexReader reader, int docId, String content)` The primary method -- return offsets for highlightable words in the specified document.

    - ### Methods inherited from class org.apache.lucene.search.uhighlight.AnalysisOffsetStrategy

      `getOffsetSource, tokenStream`

    - ### Methods inherited from class org.apache.lucene.search.uhighlight.FieldOffsetStrategy

      `createOffsetsEnumFromReader, createOffsetsEnumsForAutomata, createOffsetsEnumsForTerms, getField`

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

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

- - ### Constructor Detail

    - #### TokenStreamOffsetStrategy

          public TokenStreamOffsetStrategy(String field,
                                           BytesRef[] terms,
                                           PhraseHelper phraseHelper,
                                           CharacterRunAutomaton[] automata,
                                           Analyzer indexAnalyzer)

  - ### Method Detail

    - #### getOffsetsEnum

          public OffsetsEnum getOffsetsEnum(IndexReader reader,
                                            int docId,
                                            String content)
                                     throws IOException

      Description copied from class: `FieldOffsetStrategy`
      The primary method -- return offsets for highlightable words in the specified document. Callers are expected to close the returned OffsetsEnum when it has been finished with
      Specified by:
        `getOffsetsEnum` in class `FieldOffsetStrategy`
      Throws:
        `IOException`

Copyright © 2000-2018 Apache Software Foundation. All Rights Reserved.