fix(typesense): fix reindexing views and positions in typesense

This commit is contained in:
kolaente 2024-04-13 16:38:45 +02:00
parent 75f830457b
commit cb648e5ad8
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 11 additions and 12 deletions

View File

@ -146,22 +146,10 @@ func CreateTypesenseCollections() error {
Name: "updated",
Type: "int64", // unix timestamp
},
{
Name: "bucket_id",
Type: "int64",
},
{
Name: "position",
Type: "float",
},
{
Name: "created_by_id",
Type: "int64",
},
{
Name: "project_view_id",
Type: "int64",
},
{
Name: "reminders",
Type: "object[]", // TODO
@ -192,6 +180,10 @@ func CreateTypesenseCollections() error {
Type: "object[]", // TODO
Optional: pointer.True(),
},
{
Name: "positions",
Type: "object",
},
},
}
@ -386,6 +378,12 @@ func indexDummyTask() (err error) {
},
},
},
Positions: map[string]float64{
"view_1": 10,
"view_2": 30,
"view_3": 5450,
"view_4": 42,
},
}
_, err = typesenseClient.Collection("tasks").
@ -461,6 +459,7 @@ func convertTaskToTypesenseTask(task *Task, positions []*TaskPosition) *typesens
Labels: task.Labels,
//RelatedTasks: task.RelatedTasks,
Attachments: task.Attachments,
Positions: make(map[string]float64, len(positions)),
}
if task.DoneAt.IsZero() {