diff options
author | Brecht Van Lommel <brecht@blender.org> | 2023-04-14 19:27:11 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-14 13:27:11 -0400 |
commit | b667634b32e240f3f3260ab7e304f72f4ff75659 (patch) | |
tree | 4f3dfeffcbd8a56e983460906c2009a7009cd20d /modules | |
parent | 1c8bc4081a4f4d0d921ac218cb724ce97924d410 (diff) | |
download | gitea-b667634b32e240f3f3260ab7e304f72f4ff75659.tar.gz gitea-b667634b32e240f3f3260ab7e304f72f4ff75659.zip |
Fix meilisearch not working when searching across multiple repositories (#24109)
This would happen in the issue and pull request dashboards, while the
per repository lists worked fine.
Use OR instead of AND for repo IDs.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/indexer/issues/meilisearch.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/modules/indexer/issues/meilisearch.go b/modules/indexer/issues/meilisearch.go index 5c45236e66..319dc3e30b 100644 --- a/modules/indexer/issues/meilisearch.go +++ b/modules/indexer/issues/meilisearch.go @@ -6,6 +6,7 @@ package issues import ( "context" "strconv" + "strings" "sync" "time" @@ -120,10 +121,11 @@ func (b *MeilisearchIndexer) Delete(ids ...int64) error { // Search searches for issues by given conditions. // Returns the matching issue IDs func (b *MeilisearchIndexer) Search(ctx context.Context, keyword string, repoIDs []int64, limit, start int) (*SearchResult, error) { - filter := make([][]string, 0, len(repoIDs)) + repoFilters := make([]string, 0, len(repoIDs)) for _, repoID := range repoIDs { - filter = append(filter, []string{"repo_id = " + strconv.FormatInt(repoID, 10)}) + repoFilters = append(repoFilters, "repo_id = "+strconv.FormatInt(repoID, 10)) } + filter := strings.Join(repoFilters, " OR ") searchRes, err := b.client.Index(b.indexerName).Search(keyword, &meilisearch.SearchRequest{ Filter: filter, Limit: int64(limit), |