From e6e6f428f5b383eead78e56ecda4ae64dfb04e96 Mon Sep 17 00:00:00 2001 From: Keegan Carruthers-Smith Date: Tue, 14 Dec 2021 16:46:15 +0200 Subject: [PATCH] eval: do not sort matches in indexData.Search We already do sorting in shards.go. By sorting in Search we no longer have matches from the same repo next to each other. --- eval.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/eval.go b/eval.go index 4950f205d..0fe04c845 100644 --- a/eval.go +++ b/eval.go @@ -346,7 +346,10 @@ nextFileMatch: res.Stats.MatchCount += len(fileMatch.LineMatches) res.Stats.FileCount++ } - SortFilesByScore(res.Files) + + // We do not sort Files here, instead we rely on the shards pkg to do file + // ranking. If we sorted now, we would break the assumption that results + // from the same repo in a shard appear next to each other. for _, md := range d.repoMetaData { r := md