meilisearch/document.go

36 lines
748 B
Go

package meilisearch
import "git.selly.red/Selly-Modules/logger"
func (i *Index) AddDocuments(docs interface{}) error {
_, err := getIndex(i.Name).AddDocuments(docs)
if err != nil {
logger.Error("add documents", logger.LogData{
Source: "meilisearch.index.AddDocuments",
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 {
logger.Error("delete documents", logger.LogData{
Source: "meilisearch.index.DeleteDocumentsByPrimaryKeys",
Message: err.Error(),
Data: logger.Map{
"index": i,
"keys": keys,
},
})
}
return err
}