
Highlighter
- Namespace
- Rowles.LeanCorpus.Search.Highlighting
- Assembly
- Rowles.LeanCorpus.dll
Extracts text snippets from stored fields with matching terms highlighted. Query term occurrences are located directly in the text via case-insensitive substring search with word-boundary validation, avoiding the cost of full re-analysis through the standard analyser pipeline.
public sealed class Highlighter : IHighlighter
- Inheritance
-
Highlighter
- Implements
Highlighter(string, string, IAnalyser?)
Initialises a new Highlighter with the given tags.
ExtractTerms(Query)
Extracts query terms from a query for use with GetBestFragment.
GetBestFragment(string, Query, IReadOnlyList<TermVectorEntry>?, int)
Returns the best snippet from text containing highlighted
occurrences of the query terms.
GetBestFragment(string, IReadOnlySet<string>, int)
Returns the best snippet from text containing highlighted
occurrences of the query terms. Returns the original text (truncated) if no matches.