org.apache.lucene.search.uhighlight

## Class LengthGoalBreakIterator

- java.lang.Object
- - java.text.BreakIterator
  - - org.apache.lucene.search.uhighlight.LengthGoalBreakIterator

- All Implemented Interfaces:
    Cloneable

      public class LengthGoalBreakIterator
      extends BreakIterator

  Wraps another `BreakIterator` to skip past breaks that would result in passages that are too short. It's still possible to get a short passage but only at the very end of the input text.

  Important: This is not a general purpose `BreakIterator`; it's only designed to work in a way compatible with the `UnifiedHighlighter`. Some assumptions are checked with Java assertions.

  WARNING: This API is experimental and might change in incompatible ways in the next release.

- - ### Field Summary

    - ### Fields inherited from class java.text.BreakIterator

      `DONE`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Object` | `clone()`
    `static LengthGoalBreakIterator` | `createClosestToLength(BreakIterator baseIter, int targetLength)` Breaks will be on average `targetLength` apart; the closest break to this target (before or after) is chosen.
    `static LengthGoalBreakIterator` | `createMinLength(BreakIterator baseIter, int minLength)` Breaks will be at least `minLength` apart (to the extent possible).
    `int` | `current()`
    `int` | `first()`
    `int` | `following(int followingIdx)`
    `CharacterIterator` | `getText()`
    `boolean` | `isBoundary(int offset)`
    `int` | `last()`
    `int` | `next()`
    `int` | `next(int n)`
    `int` | `preceding(int offset)`
    `int` | `previous()`
    `void` | `setText(CharacterIterator newText)`
    `void` | `setText(String newText)`
    `String` | `toString()`

    - ### Methods inherited from class java.text.BreakIterator

      `getAvailableLocales, getCharacterInstance, getCharacterInstance, getLineInstance, getLineInstance, getSentenceInstance, getSentenceInstance, getWordInstance, getWordInstance`

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

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

- - ### Method Detail

    - #### createMinLength

          public static LengthGoalBreakIterator createMinLength(BreakIterator baseIter,
                                                                int minLength)

      Breaks will be at least `minLength` apart (to the extent possible).

    - #### createClosestToLength

          public static LengthGoalBreakIterator createClosestToLength(BreakIterator baseIter,
                                                                      int targetLength)

      Breaks will be on average `targetLength` apart; the closest break to this target (before or after) is chosen.

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### clone

          public Object clone()

      Overrides:
        `clone` in class `BreakIterator`

    - #### getText

          public CharacterIterator getText()

      Specified by:
        `getText` in class `BreakIterator`

    - #### setText

          public void setText(String newText)

      Overrides:
        `setText` in class `BreakIterator`

    - #### setText

          public void setText(CharacterIterator newText)

      Specified by:
        `setText` in class `BreakIterator`

    - #### current

          public int current()

      Specified by:
        `current` in class `BreakIterator`

    - #### first

          public int first()

      Specified by:
        `first` in class `BreakIterator`

    - #### last

          public int last()

      Specified by:
        `last` in class `BreakIterator`

    - #### next

          public int next(int n)

      Specified by:
        `next` in class `BreakIterator`

    - #### next

          public int next()

      Specified by:
        `next` in class `BreakIterator`

    - #### previous

          public int previous()

      Specified by:
        `previous` in class `BreakIterator`

    - #### following

          public int following(int followingIdx)

      Specified by:
        `following` in class `BreakIterator`

    - #### preceding

          public int preceding(int offset)

      Overrides:
        `preceding` in class `BreakIterator`

    - #### isBoundary

          public boolean isBoundary(int offset)

      Overrides:
        `isBoundary` in class `BreakIterator`

Copyright © 2000-2018 Apache Software Foundation. All Rights Reserved.