mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-08-31 06:34:00 +00:00
chore(dep): Update module meilisearch to v0.33 (#8788)
Fixes the breakages with the version update... Co-authored-by: Renovate Bot <forgejo-renovate-action@forgejo.org> Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8788 Reviewed-by: Gusted <gusted@noreply.codeberg.org> Co-authored-by: Shiny Nematoda <snematoda.751k2@aleeas.com> Co-committed-by: Shiny Nematoda <snematoda.751k2@aleeas.com>
This commit is contained in:
parent
6faaf807ff
commit
a1dd77d115
4 changed files with 32 additions and 33 deletions
|
@ -13,6 +13,7 @@ import (
|
|||
indexer_internal "forgejo.org/modules/indexer/internal"
|
||||
inner_meilisearch "forgejo.org/modules/indexer/internal/meilisearch"
|
||||
"forgejo.org/modules/indexer/issues/internal"
|
||||
"forgejo.org/modules/json"
|
||||
|
||||
"github.com/meilisearch/meilisearch-go"
|
||||
)
|
||||
|
@ -100,7 +101,7 @@ func (b *Indexer) Index(_ context.Context, issues ...*internal.IndexerData) erro
|
|||
return nil
|
||||
}
|
||||
for _, issue := range issues {
|
||||
_, err := b.inner.Client.Index(b.inner.VersionedIndexName()).AddDocuments(issue)
|
||||
_, err := b.inner.Client.Index(b.inner.VersionedIndexName()).AddDocuments(issue, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -305,18 +306,13 @@ func doubleQuoteKeyword(k string) string {
|
|||
func convertHits(searchRes *meilisearch.SearchResponse) ([]internal.Match, error) {
|
||||
hits := make([]internal.Match, 0, len(searchRes.Hits))
|
||||
for _, hit := range searchRes.Hits {
|
||||
hit, ok := hit.(map[string]any)
|
||||
if !ok {
|
||||
return nil, ErrMalformedResponse
|
||||
}
|
||||
|
||||
issueID, ok := hit["id"].(float64)
|
||||
if !ok {
|
||||
var issueID int64
|
||||
if err := json.Unmarshal(hit["id"], &issueID); err != nil {
|
||||
return nil, ErrMalformedResponse
|
||||
}
|
||||
|
||||
hits = append(hits, internal.Match{
|
||||
ID: int64(issueID),
|
||||
ID: issueID,
|
||||
})
|
||||
}
|
||||
return hits, nil
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue