Class BoundedBreakIteratorScanner

org.apache.lucene.search.uhighlight.BoundedBreakIteratorScanner
All Implemented Interfaces:

public class BoundedBreakIteratorScanner extends
A custom break iterator that is used to find break-delimited passages bounded by a provided maximum length in the UnifiedHighlighter context. This class uses a to find the last break after the provided offset that would create a passage smaller than maxLen. If the cannot find a passage smaller than the maximum length, a secondary break iterator is used to re-split the passage at the first boundary after maximum length. This is useful to split passages created by s like `sentence` that can create big outliers on semi-structured text. WARNING: This break iterator is designed to work with the UnifiedHighlighter. TODO: We should be able to create passages incrementally, starting from the offset of the first match and expanding or not depending on the offsets of subsequent matches. This is currently impossible because FieldHighlighter uses only the first matching offset to derive the start and end of each passage.
  • Field Summary

    Fields inherited from class java.text.

  • Method Summary

    Modifier and Type
    Method
    Description
    int
     
    int
     
    int
    following​(int offset)
    Can be invoked only after a call to preceding(offset+1).
    static
     locale, int maxLen)
    Returns a bounded to maxLen.
     
    int
     
    int
     
    int
    next​(int n)
     
    int
    preceding​(int offset)
    Must be called with increasing offset.
    int
     
    void
     newText)
     
    void
     newText)
     

    Methods inherited from class java.text.

    , , , , , , , , , ,

    Methods inherited from class java.lang.

    , , , , , , , , ,
  • Method Details

    • getText

      public  getText()
      Specified by:
       in class 
    • setText

      public void setText( newText)
      Specified by:
       in class 
    • setText

      public void setText( newText)
      Overrides:
       in class 
    • preceding

      public int preceding(int offset)
      Must be called with increasing offset. See FieldHighlighter for usage.
      Overrides:
       in class 
    • following

      public int following(int offset)
      Can be invoked only after a call to preceding(offset+1). See FieldHighlighter for usage.
      Specified by:
       in class 
    • getSentence

      public static  getSentence( locale, int maxLen)
      Returns a bounded to maxLen. Secondary boundaries are found using a .
    • current

      public int current()
      Specified by:
       in class 
    • first

      public int first()
      Specified by:
       in class 
    • next

      public int next()
      Specified by:
       in class 
    • last

      public int last()
      Specified by:
       in class 
    • next

      public int next(int n)
      Specified by:
       in class 
    • previous

      public int previous()
      Specified by:
       in class