BaseFragListBuilder (Lucene 10.5.0 highlighter API)
Description: declaration: package: org.apache.lucene.search.vectorhighlight, class: BaseFragListBuilder

Package org.apache.lucene.search.vectorhighlight

# Class BaseFragListBuilder

java.lang.Object
org.apache.lucene.search.vectorhighlight.BaseFragListBuilder

All Implemented Interfaces:
  `FragListBuilder`

Direct Known Subclasses:
  `SimpleFragListBuilder`, `WeightedFragListBuilder`

public abstract class BaseFragListBuilder extends Object implements FragListBuilder
A abstract implementation of `FragListBuilder`.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `MARGIN_DEFAULT`
  `static final int`
  `MIN_FRAG_CHAR_SIZE_FACTOR`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `BaseFragListBuilder()`
  `BaseFragListBuilder(int margin)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected boolean`
  `acceptPhrase(FieldPhraseList.WeightedPhraseInfo info, int matchLength, int fragCharSize)`
  A predicate to decide if the given `FieldPhraseList.WeightedPhraseInfo` should be accepted as a highlighted phrase or if it should be discarded.
  `protected FieldFragList`
  `createFieldFragList(FieldPhraseList fieldPhraseList, FieldFragList fieldFragList, int fragCharSize)`

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

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

  ### Methods inherited from interface org.apache.lucene.search.vectorhighlight.FragListBuilder

  `createFieldFragList`

- ## Field Details

  - ### MARGIN_DEFAULT

    public static final int MARGIN_DEFAULT
    See Also:
      - Constant Field Values

  - ### MIN_FRAG_CHAR_SIZE_FACTOR

    public static final int MIN_FRAG_CHAR_SIZE_FACTOR
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### BaseFragListBuilder

    public BaseFragListBuilder(int margin)

  - ### BaseFragListBuilder

    public BaseFragListBuilder()

- ## Method Details

  - ### createFieldFragList

    protected FieldFragList createFieldFragList(FieldPhraseList fieldPhraseList, FieldFragList fieldFragList, int fragCharSize)

  - ### acceptPhrase

    protected boolean acceptPhrase(FieldPhraseList.WeightedPhraseInfo info, int matchLength, int fragCharSize)
    A predicate to decide if the given `FieldPhraseList.WeightedPhraseInfo` should be accepted as a highlighted phrase or if it should be discarded.

    The default implementation discards phrases that are composed of more than one term and where the matchLength exceeds the fragment character size.

    Parameters:
      `info` - the phrase info to accept
      `matchLength` - the match length of the current phrase
      `fragCharSize` - the configured fragment character size
    Returns:
      `true` if this phrase info should be accepted as a highligh phrase