Class FieldHighlighter
- java.lang.Object
-
- org.apache.lucene.search.uhighlight.FieldHighlighter
-
public class FieldHighlighter extends Object
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
Fields Modifier and Type Field Description protected BreakIterator
breakIterator
protected String
field
protected FieldOffsetStrategy
fieldOffsetStrategy
protected int
maxNoHighlightPassages
protected int
maxPassages
protected PassageFormatter
passageFormatter
protected PassageScorer
passageScorer
protected Comparator<Passage>
passageSortComparator
-
Constructor Summary
Constructors Constructor Description FieldHighlighter(String field, FieldOffsetStrategy fieldOffsetStrategy, BreakIterator breakIterator, PassageScorer passageScorer, int maxPassages, int maxNoHighlightPassages, PassageFormatter passageFormatter, Comparator<Passage> passageSortComparator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getField()
UnifiedHighlighter.OffsetSource
getOffsetSource()
protected Passage[]
getSummaryPassagesNoHighlight(int maxPassages)
Called to summarize a document when no highlights were found.Object
highlightFieldForDoc(LeafReader reader, int docId, String content)
The primary method -- highlight this doc, assuming a specific field and given this content.protected Passage[]
highlightOffsetsEnums(OffsetsEnum off)
-
-
-
Field Detail
-
field
protected final String field
-
fieldOffsetStrategy
protected final FieldOffsetStrategy fieldOffsetStrategy
-
breakIterator
protected final BreakIterator breakIterator
-
passageScorer
protected final PassageScorer passageScorer
-
maxPassages
protected final int maxPassages
-
maxNoHighlightPassages
protected final int maxNoHighlightPassages
-
passageFormatter
protected final PassageFormatter passageFormatter
-
passageSortComparator
protected final Comparator<Passage> passageSortComparator
-
-
Constructor Detail
-
FieldHighlighter
public FieldHighlighter(String field, FieldOffsetStrategy fieldOffsetStrategy, BreakIterator breakIterator, PassageScorer passageScorer, int maxPassages, int maxNoHighlightPassages, PassageFormatter passageFormatter, Comparator<Passage> passageSortComparator)
-
-
Method Detail
-
getField
public String getField()
-
getOffsetSource
public UnifiedHighlighter.OffsetSource getOffsetSource()
-
highlightFieldForDoc
public Object highlightFieldForDoc(LeafReader reader, int docId, String content) throws IOException
The primary method -- highlight this doc, assuming a specific field and given this content.- Throws:
IOException
-
getSummaryPassagesNoHighlight
protected Passage[] getSummaryPassagesNoHighlight(int maxPassages)
Called to summarize a document when no highlights were found. By default this just returns the firstmaxPassages
sentences; subclasses can override to customize. The state ofbreakIterator
should be at the beginning.
-
highlightOffsetsEnums
protected Passage[] highlightOffsetsEnums(OffsetsEnum off) throws IOException
- Throws:
IOException
-
-