Class CustomUnifiedHighlighter


  • public class CustomUnifiedHighlighter
    extends UnifiedHighlighter
    Subclass of the UnifiedHighlighter that works for a single field in a single document. Uses a custom PassageFormatter. Accepts field content as a constructor argument, given that loadings field value can be done reading from _source field. Supports using different BreakIterator to break the text into fragments. Considers every distinct field value as a discrete passage for highlighting (unless the whole content needs to be highlighted). Supports both returning empty snippets and non highlighted snippets when no highlighting can be performed.