From b8d9d6d5a65d565a80df7825f641f0360c544063 Mon Sep 17 00:00:00 2001 From: namhq1989 Date: Tue, 15 Nov 2022 09:57:02 +0700 Subject: [PATCH] add method UpdateDocuments --- document.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/document.go b/document.go index dcaa79d..6273a61 100644 --- a/document.go +++ b/document.go @@ -18,6 +18,22 @@ func (i *Index) AddDocuments(docs interface{}) error { return err } +func (i *Index) UpdateDocuments(docs interface{}) error { + _, err := getIndex(i.Name).UpdateDocuments(docs) + if err != nil { + logger.Error("update documents", logger.LogData{ + Source: "meilisearch.index.UpdateDocuments", + Message: err.Error(), + Data: logger.Map{ + "index": i, + "docs": docs, + }, + }) + } + + return err +} + func (i *Index) DeleteDocumentsByPrimaryKeys(keys []string) error { _, err := getIndex(i.Name).DeleteDocuments(keys) if err != nil {