Skip to content

Commit b667634

Browse files
authored
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.
1 parent 1c8bc40 commit b667634

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

modules/indexer/issues/meilisearch.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ package issues
66
import (
77
"context"
88
"strconv"
9+
"strings"
910
"sync"
1011
"time"
1112

@@ -120,10 +121,11 @@ func (b *MeilisearchIndexer) Delete(ids ...int64) error {
120121
// Search searches for issues by given conditions.
121122
// Returns the matching issue IDs
122123
func (b *MeilisearchIndexer) Search(ctx context.Context, keyword string, repoIDs []int64, limit, start int) (*SearchResult, error) {
123-
filter := make([][]string, 0, len(repoIDs))
124+
repoFilters := make([]string, 0, len(repoIDs))
124125
for _, repoID := range repoIDs {
125-
filter = append(filter, []string{"repo_id = " + strconv.FormatInt(repoID, 10)})
126+
repoFilters = append(repoFilters, "repo_id = "+strconv.FormatInt(repoID, 10))
126127
}
128+
filter := strings.Join(repoFilters, " OR ")
127129
searchRes, err := b.client.Index(b.indexerName).Search(keyword, &meilisearch.SearchRequest{
128130
Filter: filter,
129131
Limit: int64(limit),

0 commit comments

Comments
 (0)