Class MatchHighlighter
- java.lang.Object
-
- org.apache.lucene.search.matchhighlight.MatchHighlighter
-
public class MatchHighlighter extends Object
An example highlighter that combines several lower-level highlighting utilities in this package into a fully featured, ready-to-use component.Note that if you need to customize or tweak the details of highlighting, it is better to assemble your own highlighter using those low-level building blocks, rather than extend or modify this one.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MatchHighlighter.DocHighlights
Single document's highlights.static interface
MatchHighlighter.FieldValueHighlighter
Actual per-field highlighter.static class
MatchHighlighter.QueryOffsetRange
AnOffsetRange
of a match, together with the source query that caused it.
-
Constructor Summary
Constructors Constructor Description MatchHighlighter(IndexSearcher searcher, Analyzer analyzer)
MatchHighlighter(IndexSearcher searcher, Analyzer analyzer, OffsetsRetrievalStrategySupplier offsetsRetrievalStrategies)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
alwaysFetchFields(String... fields)
Always fetch the given set of fields for all input documents.MatchHighlighter
appendFieldHighlighter(MatchHighlighter.FieldValueHighlighter highlighter)
Append a new highlighter to field highlighters chain.Stream<MatchHighlighter.DocHighlights>
highlight(TopDocs topDocs, Query... queries)
-
-
-
Constructor Detail
-
MatchHighlighter
public MatchHighlighter(IndexSearcher searcher, Analyzer analyzer)
-
MatchHighlighter
public MatchHighlighter(IndexSearcher searcher, Analyzer analyzer, OffsetsRetrievalStrategySupplier offsetsRetrievalStrategies)
-
-
Method Detail
-
appendFieldHighlighter
public MatchHighlighter appendFieldHighlighter(MatchHighlighter.FieldValueHighlighter highlighter)
Append a new highlighter to field highlighters chain. The order of field highlighters is important (first-matching wins).
-
alwaysFetchFields
public void alwaysFetchFields(String... fields)
Always fetch the given set of fields for all input documents.
-
highlight
public Stream<MatchHighlighter.DocHighlights> highlight(TopDocs topDocs, Query... queries) throws IOException
- Throws:
IOException
-
-