# UNDF: UNDF-2026-000000895 --- a/modules/indexer/code/search.go +++ b/modules/indexer/code/search.go @@ -50,12 +50,13 @@ type Results []*Result // Get the set of repo IDs from a list of search results func (res Results) RepoIDs() []int64 { - ids := make([]int64, len(res)) + seen := make(map[int64]struct{}, len(res)) + ids := make([]int64, 0, len(res)) for _, r := range res { - if !slices.Contains(ids, r.RepoID) { + if _, ok := seen[r.RepoID]; !ok { + seen[r.RepoID] = struct{}{} ids = append(ids, r.RepoID) } } return ids }