Update meilisearch to v1.36.0 (#847)
* Update meilisearch to v1.36.0 * Merge remote-tracking branch 'origin/main' into chore/update-meilisearch --------- Co-authored-by: Christian Beutel <>
This commit is contained in:
@@ -174,7 +174,7 @@ func getPolyline(app core.App, r *core.Record) (string, error) {
|
||||
return string(polyline.EncodeCoords(coordinates)), nil
|
||||
}
|
||||
|
||||
func documentFromListRecord(r *core.Record, author *core.Record, includeShares bool) (map[string]interface{}, error) {
|
||||
func documentFromListRecord(r *core.Record, author *core.Record, includeShares bool) (map[string]any, error) {
|
||||
|
||||
totalElevationGain := 0.0
|
||||
totalElevationLoss := 0.0
|
||||
@@ -247,7 +247,7 @@ func documentFromListRecord(r *core.Record, author *core.Record, includeShares b
|
||||
return document, nil
|
||||
}
|
||||
|
||||
func documentFromRemoteRecord(r *core.Record, index string) (map[string]interface{}, error) {
|
||||
func documentFromRemoteRecord(r *core.Record, index string) (map[string]any, error) {
|
||||
client := &http.Client{}
|
||||
|
||||
if r.GetString("iri") == "" {
|
||||
@@ -294,10 +294,16 @@ func documentFromRemoteRecord(r *core.Record, index string) (map[string]interfac
|
||||
return nil, fmt.Errorf("no documents in result set")
|
||||
}
|
||||
|
||||
document, ok := searchResponse.Hits[0].(map[string]interface{})
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected document format")
|
||||
var document map[string]any
|
||||
documentByteData, err := json.Marshal(searchResponse.Hits[0])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if err := json.Unmarshal(documentByteData, &document); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return document, nil
|
||||
}
|
||||
|
||||
@@ -336,7 +342,7 @@ func IndexTrails(app core.App, trails []*core.Record, client meilisearch.Service
|
||||
documents[i] = doc
|
||||
}
|
||||
|
||||
if _, err := client.Index("trails").AddDocuments(documents); err != nil {
|
||||
if _, err := client.Index("trails").AddDocuments(documents, nil); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -359,7 +365,7 @@ func UpdateTrail(app core.App, r *core.Record, author *core.Record, client meili
|
||||
}
|
||||
documents := []map[string]interface{}{doc}
|
||||
|
||||
task, err := client.Index("trails").UpdateDocuments(documents)
|
||||
task, err := client.Index("trails").UpdateDocuments(documents, nil)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -381,7 +387,7 @@ func UpdateTrailShares(trailId string, shares []string, client meilisearch.Servi
|
||||
"shares": shares,
|
||||
},
|
||||
}
|
||||
if _, err := client.Index("trails").UpdateDocuments(documents); err != nil {
|
||||
if _, err := client.Index("trails").UpdateDocuments(documents, nil); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
@@ -395,7 +401,7 @@ func UpdateTrailLikes(trailId string, likes []string, client meilisearch.Service
|
||||
"likes": likes,
|
||||
},
|
||||
}
|
||||
if _, err := client.Index("trails").UpdateDocuments(documents); err != nil {
|
||||
if _, err := client.Index("trails").UpdateDocuments(documents, nil); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
@@ -426,7 +432,7 @@ func IndexLists(app core.App, lists []*core.Record, client meilisearch.ServiceMa
|
||||
}
|
||||
documents[i] = doc
|
||||
}
|
||||
if _, err := client.Index("lists").AddDocuments(documents); err != nil {
|
||||
if _, err := client.Index("lists").AddDocuments(documents, nil); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -444,7 +450,7 @@ func UpdateList(app core.App, r *core.Record, author *core.Record, client meilis
|
||||
return err
|
||||
}
|
||||
|
||||
if _, err = client.Index("lists").UpdateDocuments(documents); err != nil {
|
||||
if _, err = client.Index("lists").UpdateDocuments(documents, nil); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -458,7 +464,7 @@ func UpdateListShares(listId string, shares []string, client meilisearch.Service
|
||||
"shares": shares,
|
||||
},
|
||||
}
|
||||
if _, err := client.Index("lists").UpdateDocuments(documents); err != nil {
|
||||
if _, err := client.Index("lists").UpdateDocuments(documents, nil); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user