Skip to content

Commit

Permalink
eval: do not sort matches in indexData.Search
Browse files Browse the repository at this point in the history
We already do sorting in shards.go. By sorting in Search we no longer
have matches from the same repo next to each other.
  • Loading branch information
keegancsmith committed Dec 14, 2021
1 parent 1e39407 commit e6e6f42
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion eval.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

This comment has been minimized.

Copy link
@ggilmore

ggilmore Dec 14, 2021

Contributor

Is there a better place to put this comment? I feel like this is only here because this describes what used to be the previous behavior - not because it describes the current flow of the function

This comment has been minimized.

Copy link
@keegancsmith

keegancsmith Dec 15, 2021

Author Member

It was put here because I added this back when comparing to vanilla zoekt. Now when you do a diff we will have this comment. So this is useful to us until we have diverged too far from vanilla zoekt.

Note: sorting here doesn't actually break anything, just makes things less efficient. I think we need to improve our test coverage for compound shards before releaseing to everyone anyways. This is the sort of thing to tackle, ensure these sort of perf invariants are kept.

// 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
Expand Down

0 comments on commit e6e6f42

Please sign in to comment.