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

Package org.apache.lucene.search.matchhighlight

# Class PassageSelector

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

public class PassageSelector extends Object
Selects fragments of text that score best for the given set of highlight markers.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final Comparator<Passage>`
  `DEFAULT_SCORER`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `PassageSelector()`
  `PassageSelector(Comparator<Passage> passageScorer, PassageAdjuster passageAdjuster)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `List<Passage>`
  `pickBest(CharSequence value, List<? extends OffsetRange> markers, int maxPassageWindow, int maxPassages)`
  `List<Passage>`
  `pickBest(CharSequence value, List<? extends OffsetRange> markers, int maxPassageWindow, int maxPassages, List<OffsetRange> permittedPassageRanges)`
  `protected Passage[]`
  `pickDefaultPassage(CharSequence value, int maxCharacterWindow, int maxPassages, List<OffsetRange> permittedPassageRanges)`
  Invoked when no passages could be selected (due to constraints or lack of highlight markers).

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

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

- ## Field Details

  - ### DEFAULT_SCORER

    public static final Comparator<Passage> DEFAULT_SCORER

- ## Constructor Details

  - ### PassageSelector

    public PassageSelector()

  - ### PassageSelector

    public PassageSelector(Comparator<Passage> passageScorer, PassageAdjuster passageAdjuster)

- ## Method Details

  - ### pickBest

    public List<Passage> pickBest(CharSequence value, List<? extends OffsetRange> markers, int maxPassageWindow, int maxPassages)

  - ### pickBest

    public List<Passage> pickBest(CharSequence value, List<? extends OffsetRange> markers, int maxPassageWindow, int maxPassages, List<OffsetRange> permittedPassageRanges)

  - ### pickDefaultPassage

    protected Passage[] pickDefaultPassage(CharSequence value, int maxCharacterWindow, int maxPassages, List<OffsetRange> permittedPassageRanges)
    Invoked when no passages could be selected (due to constraints or lack of highlight markers).