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
termTermQueryAn exact term of an indexed field. It isn't analyzed (see Term(string, string)).
jsonstringThe 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
termTermQueryAn exact term of an indexed field. It isn't analyzed (see Term(string, string)).
utf8JsonReadOnlySpan<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
termTermQueryAn exact term of an indexed field. It isn't analyzed (see Term(string, string)).
documentTThe new document, serialized as in AddDocument<T>(T, JsonTypeInfo<T>).
typeInfoJsonTypeInfo<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
termTermQueryAn exact term of an indexed field. It isn't analyzed (see Term(string, string)).
documentobjectThe new document, serialized as in AddDocument(object).