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
documentDocumentThe example document's fields.
optionsMoreLikeThisOptionsTerm selection settings, or null for Tantivy's defaults.
Returns
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
fieldTextsIReadOnlyDictionary<string, string>Field name to text; the text is analyzed with the field's tokenizer.
optionsMoreLikeThisOptionsTerm selection settings, or null for Tantivy's defaults.