Package org.apache.lucene.search.matchhighlight
package org.apache.lucene.search.matchhighlight
This package contains several components useful to build a highlighter on top of the
Matches
API.
MatchRegionRetriever
can be used to retrieve
hit areas for a given Query
and one (or more) indexed documents.
These hit areas can be then passed to PassageSelector
and formatted with PassageFormatter
.
-
ClassDescriptionA
PassageAdjuster
that adjusts thePassage
range to word boundaries hinted by the givenBreakIterator
.A factory ofMatchHighlighter.FieldValueHighlighter
classes that cover typical use cases (verbatim values, highlights, abbreviations).An example highlighter that combines several lower-level utility classes in this package into a fully featured, ready-to-use component.Single document's highlights.Actual per-field highlighter.AnOffsetRange
of a match, together with the source query that caused it.Utility class to compute a list of "match regions" for a given query, searcher and document(s) usingMatches
API.Access to field values of the highlighted document.A callback invoked for each document selected by the query.A non-empty range of offset positions.This strategy retrieves offsets directly fromMatchesIterator
, if they are available, otherwise it falls back to usingOffsetsFromPositions
.This strategy applies to fields with stored positions but no offsets.This strategy works for fields where we know the match occurred but there are no known positions or offsets.This strategy works for fields where we know the match occurred but there are no known positions or offsets.Determines how match offset regions are computed fromMatchesIterator
.A per-field supplier ofOffsetsRetrievalStrategy
.A passage is a fragment of source text, scored and possibly with a list of sub-offsets (markers) to be highlighted.Adjusts the range of one or more passages over a given value.Formats a collection of passages over a given string, cleaning up and resolving restrictions concerning overlaps, allowed sub-ranges over the input string and length restrictions.Selects fragments of text that score best for the given set of highlight markers.