Class FieldHighlighter

java.lang.Object
org.apache.lucene.search.uhighlight.FieldHighlighter

public class FieldHighlighter extends Object
Internal highlighter abstraction that operates on a per field basis.
NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.
  • Field Details

    • field

      protected final String field
    • fieldOffsetStrategy

      protected final FieldOffsetStrategy fieldOffsetStrategy
    • breakIterator

      protected final BreakIterator breakIterator
    • passageScorer

      protected final PassageScorer passageScorer
    • maxPassages

      protected final int maxPassages
    • maxNoHighlightPassages

      protected final int maxNoHighlightPassages
    • passageFormatter

      protected final PassageFormatter passageFormatter
  • Constructor Details

  • Method Details

    • getField

      public String getField()
    • getOffsetSource

      public UnifiedHighlighter.OffsetSource getOffsetSource()
    • highlightFieldForDoc

      public Object highlightFieldForDoc(LeafReader reader, int docId, String content) throws IOException
      The primary method -- highlight this doc, assuming a specific field and given this content.
      Throws:
      IOException
    • getSummaryPassagesNoHighlight

      protected Passage[] getSummaryPassagesNoHighlight(int maxPassages)
      Called to summarize a document when no highlights were found. By default this just returns the first maxPassages sentences; subclasses can override to customize. The state of breakIterator should be at the beginning.
    • highlightOffsetsEnums

      protected Passage[] highlightOffsetsEnums(OffsetsEnum off) throws IOException
      Throws:
      IOException