Table of Contents

Method UpdateDocument

Namespace
TantivyDotNet
Assembly
TantivyDotNet.dll

UpdateDocument(TermQuery, string)

Replaces the documents containing term with a new document given as JSON: deletes them and adds the new document in one operation, so a commit includes both or neither. Typically term is an ID: Query.Term("id", "b42").

public void UpdateDocument(TermQuery term, string json)

Parameters

term TermQuery

An exact term of an indexed field. It isn't analyzed (see Term(string, string)).

json string

The new document; see AddDocument(string).

Exceptions

TantivyException

With InvalidArgument if the term doesn't fit the schema or the document is invalid. Nothing is deleted then.

UpdateDocument(TermQuery, ReadOnlySpan<byte>)

Replaces the documents containing term with a new document given as JSON: deletes them and adds the new document in one operation, so a commit includes both or neither. Typically term is an ID: Query.Term("id", "b42").

public void UpdateDocument(TermQuery term, ReadOnlySpan<byte> utf8Json)

Parameters

term TermQuery

An exact term of an indexed field. It isn't analyzed (see Term(string, string)).

utf8Json ReadOnlySpan<byte>

The new document as UTF-8 JSON.

UpdateDocument<T>(TermQuery, T, JsonTypeInfo<T>)

Replaces the documents containing term with a new document given as JSON: deletes them and adds the new document in one operation, so a commit includes both or neither. Typically term is an ID: Query.Term("id", "b42").

public void UpdateDocument<T>(TermQuery term, T document, JsonTypeInfo<T> typeInfo)

Parameters

term TermQuery

An exact term of an indexed field. It isn't analyzed (see Term(string, string)).

document T

The new document, serialized as in AddDocument<T>(T, JsonTypeInfo<T>).

typeInfo JsonTypeInfo<T>

Source-generated metadata for T.

Type Parameters

T

UpdateDocument(TermQuery, object)

Replaces the documents containing term with a new document given as JSON: deletes them and adds the new document in one operation, so a commit includes both or neither. Typically term is an ID: Query.Term("id", "b42").

[RequiresUnreferencedCode("Reflection-based JSON serialization. Use UpdateDocument<T>(TermQuery, T, JsonTypeInfo<T>) for trimmed apps.")]
[RequiresDynamicCode("Reflection-based JSON serialization. Use UpdateDocument<T>(TermQuery, T, JsonTypeInfo<T>) for NativeAOT apps.")]
public void UpdateDocument(TermQuery term, object document)

Parameters

term TermQuery

An exact term of an indexed field. It isn't analyzed (see Term(string, string)).

document object

The new document, serialized as in AddDocument(object).