add method UpdateDocuments

This commit is contained in:
namhq1989 2022-11-15 09:57:02 +07:00
parent e13e828f3c
commit b8d9d6d5a6
1 changed files with 16 additions and 0 deletions

View File

@ -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 {