Class FieldHighlighter
java.lang.Object
org.apache.lucene.search.uhighlight.FieldHighlighter
Internal highlighter abstraction that operates on a per field basis.
- NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final BreakIteratorprotected final Stringprotected final FieldOffsetStrategyprotected final intprotected final intprotected final PassageFormatterprotected final PassageScorerprotected final Comparator<Passage> -
Constructor Summary
ConstructorsConstructorDescriptionFieldHighlighter(String field, FieldOffsetStrategy fieldOffsetStrategy, BreakIterator breakIterator, PassageScorer passageScorer, int maxPassages, int maxNoHighlightPassages, PassageFormatter passageFormatter, Comparator<Passage> passageSortComparator) -
Method Summary
Modifier and TypeMethodDescriptiongetField()protected Passage[]getSummaryPassagesNoHighlight(int maxPassages) Called to summarize a document when no highlights were found.highlightFieldForDoc(LeafReader reader, int docId, String content) The primary method -- highlight this doc, assuming a specific field and given this content.protected Passage[]
-
Field Details
-
field
-
fieldOffsetStrategy
-
breakIterator
-
passageScorer
-
maxPassages
protected final int maxPassages -
maxNoHighlightPassages
protected final int maxNoHighlightPassages -
passageFormatter
-
passageSortComparator
-
-
Constructor Details
-
FieldHighlighter
public FieldHighlighter(String field, FieldOffsetStrategy fieldOffsetStrategy, BreakIterator breakIterator, PassageScorer passageScorer, int maxPassages, int maxNoHighlightPassages, PassageFormatter passageFormatter, Comparator<Passage> passageSortComparator)
-
-
Method Details
-
getField
-
getOffsetSource
-
highlightFieldForDoc
The primary method -- highlight this doc, assuming a specific field and given this content.- Throws:
IOException
-
getSummaryPassagesNoHighlight
Called to summarize a document when no highlights were found. By default this just returns the firstmaxPassagessentences; subclasses can override to customize. The state ofbreakIteratorshould be at the beginning. -
highlightOffsetsEnums
- Throws:
IOException
-