Package org.apache.lucene.search.matchhighlight

# Class PassageFormatter

java.lang.Object
org.apache.lucene.search.matchhighlight.PassageFormatter

public class PassageFormatter extends Object
Formats a collection of passages over a given string, cleaning up and resolving restrictions concerning overlaps, allowed sub-ranges over the input string and length restrictions.

Passages are demarcated with constructor-provided ellipsis and start/end marker sequences.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `PassageFormatter(String ellipsis, String markerStart, String markerEnd)`
  `PassageFormatter(String ellipsis, Function<OffsetRange,String> markerStart, Function<OffsetRange,String> markerEnd)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `List<String>`
  `format(CharSequence value, List<Passage> passages, List<OffsetRange> ranges)`
  `StringBuilder`
  `format(StringBuilder buf, CharSequence value, Passage passage)`

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

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

- ## Constructor Details

  - ### PassageFormatter

    public PassageFormatter(String ellipsis, String markerStart, String markerEnd)

  - ### PassageFormatter

    public PassageFormatter(String ellipsis, Function<OffsetRange,String> markerStart, Function<OffsetRange,String> markerEnd)

- ## Method Details

  - ### format

    public List<String> format(CharSequence value, List<Passage> passages, List<OffsetRange> ranges)

  - ### format

    public StringBuilder format(StringBuilder buf, CharSequence value, Passage passage)