fix(typesense): use emplace instead of upsert to update documents
(cherry picked from commit 3f1d0f390bddd05992f7ad1170ddfbda0bb3aec7)
This commit is contained in:
parent
25c8476883
commit
4cbed7c2ed
@ -199,8 +199,6 @@ func CreateTypesenseCollections() error {
|
||||
}
|
||||
|
||||
func ReindexAllTasks() (err error) {
|
||||
tasks := make(map[int64]*Task)
|
||||
|
||||
s := db.NewSession()
|
||||
defer s.Close()
|
||||
|
||||
@ -218,6 +216,7 @@ func ReindexAllTasks() (err error) {
|
||||
return fmt.Errorf("could not update last sync: %s", err.Error())
|
||||
}
|
||||
|
||||
tasks := make(map[int64]*Task)
|
||||
err = s.Find(tasks)
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not get all tasks: %s", err.Error())
|
||||
@ -321,7 +320,7 @@ func reindexTasksInTypesense(s *xorm.Session, tasks map[int64]*Task) (err error)
|
||||
_, err = typesenseClient.Collection("tasks").
|
||||
Documents().
|
||||
Import(context.Background(), typesenseTasks, &api.ImportDocumentsParams{
|
||||
Action: pointer.String("upsert"),
|
||||
Action: pointer.String("emplace"),
|
||||
BatchSize: pointer.Int(100),
|
||||
})
|
||||
if err != nil {
|
||||
|
Loading…
x
Reference in New Issue
Block a user