
TermVectorHighlighter
- Namespace
- Rowles.LeanCorpus.Search.Highlighting
- Assembly
- Rowles.LeanCorpus.dll
Extracts highlighted text snippets using pre-computed term vector offsets and a FieldQuery that carries per-term phrase position constraints.
public sealed class TermVectorHighlighter : IHighlighter
- Inheritance
-
TermVectorHighlighter
- Implements
Remarks
Unlike Highlighter, this class does not re-analyse the stored text when term vector offsets are available. It uses StartOffsets / EndOffsets to locate terms directly in the original text and validates phrase-position constraints against the term vector's position data.
When term vectors lack offsets (degraded mode), it falls back to the standard Highlighter using a StandardAnalyser.
TermVectorHighlighter(string, string)
Initialises a new TermVectorHighlighter with the given highlight tags.
GetBestFragment(string, FieldQuery, IReadOnlyList<TermVectorEntry>, int)
Returns the best snippet from text containing highlighted
occurrences of the query terms described by fieldQuery,
using termVectors to locate term positions and offsets.
Terms and phrase constraints are resolved across all fields referenced by the query.
GetBestFragment(string, Query, IReadOnlyList<TermVectorEntry>?, int)
Returns the best snippet from text containing highlighted
occurrences of the query terms.