Section navigation

Public classSealed 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

Public constructor Highlighter(string, string, IAnalyser?)

Initialises a new Highlighter with the given tags.

Public method ExtractTerms(Query)

Extracts query terms from a query for use with GetBestFragment.

Public method GetBestFragment(string, Query, IReadOnlyList<TermVectorEntry>?, int)

Returns the best snippet from text containing highlighted occurrences of the query terms.

Public method 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.