Table of Contents

Method MoreLikeThis

Namespace
TantivyDotNet
Assembly
TantivyDotNet.dll

MoreLikeThis(Document, MoreLikeThisOptions?)

Matches documents similar to document: its most distinctive terms (by TF-IDF, in text, numeric, date and facet fields) become a query. Typically hit.Document, which holds only stored fields. Exclude the document itself with & !Query.Term("id", ...).

public static MoreLikeThisQuery MoreLikeThis(Document document, MoreLikeThisOptions? options = null)

Parameters

document Document

The example document's fields.

options MoreLikeThisOptions

Term selection settings, or null for Tantivy's defaults.

Returns

MoreLikeThisQuery

Remarks

Fails when it runs if the document has no fields.

MoreLikeThis(IReadOnlyDictionary<string, string>, MoreLikeThisOptions?)

Matches documents similar to the given text per field, for example a draft that isn't indexed: MoreLikeThis(new Dictionary<string, string> { ["body"] = draft }).

public static MoreLikeThisQuery MoreLikeThis(IReadOnlyDictionary<string, string> fieldTexts, MoreLikeThisOptions? options = null)

Parameters

fieldTexts IReadOnlyDictionary<string, string>

Field name to text; the text is analyzed with the field's tokenizer.

options MoreLikeThisOptions

Term selection settings, or null for Tantivy's defaults.

Returns

MoreLikeThisQuery