Table of Contents

Class Snippet

Namespace
TantivyDotNet
Assembly
TantivyDotNet.dll

An excerpt of a field around the words that matched the query, with the matched words marked.

public sealed class Snippet
Inheritance
Snippet
Inherited Members

Remarks

Highlighting covers the terms of term, phrase and parsed queries. Fuzzy and range queries don't report terms, so they produce no highlights. If the field contains none of the query's terms, the snippet is empty (IsEmpty).

Properties

Fragment

The excerpt, as plain text. Empty when the field contains no query term.

Highlights

The matched words, as ranges into Fragment (so Fragment[range] is a matched word). They are sorted and don't overlap.

IsEmpty

True if nothing in the field matched the query.

Methods

ToHtml(string, string)

The fragment as HTML: the text is HTML-encoded and each match is wrapped in open and close, which are inserted as-is.

ToString()

Returns Fragment.