Class BoundedBreakIteratorScanner
java.lang.Object
java.text.BreakIterator
org.apache.lucene.search.uhighlight.BoundedBreakIteratorScanner
- All Implemented Interfaces:
- Cloneable
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 BreakIterator to find the last break after the provided offset
 that would create a passage smaller than maxLen.
 If the BreakIterator 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 BreakIterators 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 SummaryFields inherited from class java.text.BreakIteratorDONE
- 
Method SummaryModifier and TypeMethodDescriptionintcurrent()intfirst()intfollowing(int offset)Can be invoked only after a call to preceding(offset+1).static BreakIteratorgetSentence(Locale locale, int maxLen)Returns aBreakIterator.getSentenceInstance(Locale)bounded to maxLen.getText()intlast()intnext()intnext(int n)intpreceding(int offset)Must be called with increasing offset.intprevious()voidvoidsetText(CharacterIterator newText)Methods inherited from class java.text.BreakIteratorclone, getAvailableLocales, getCharacterInstance, getCharacterInstance, getLineInstance, getLineInstance, getSentenceInstance, getSentenceInstance, getWordInstance, getWordInstance, isBoundary
- 
Method Details- 
getText- Specified by:
- getTextin class- BreakIterator
 
- 
setText- Specified by:
- setTextin class- BreakIterator
 
- 
setText- Overrides:
- setTextin class- BreakIterator
 
- 
precedingpublic int preceding(int offset)Must be called with increasing offset. SeeFieldHighlighterfor usage.- Overrides:
- precedingin class- BreakIterator
 
- 
followingpublic int following(int offset)Can be invoked only after a call to preceding(offset+1). SeeFieldHighlighterfor usage.- Specified by:
- followingin class- BreakIterator
 
- 
getSentenceReturns aBreakIterator.getSentenceInstance(Locale)bounded to maxLen. Secondary boundaries are found using aBreakIterator.getWordInstance(Locale).
- 
currentpublic int current()- Specified by:
- currentin class- BreakIterator
 
- 
firstpublic int first()- Specified by:
- firstin class- BreakIterator
 
- 
nextpublic int next()- Specified by:
- nextin class- BreakIterator
 
- 
lastpublic int last()- Specified by:
- lastin class- BreakIterator
 
- 
nextpublic int next(int n)- Specified by:
- nextin class- BreakIterator
 
- 
previouspublic int previous()- Specified by:
- previousin class- BreakIterator
 
 
-