Skip to content

Search backend: sort line matches before limit truncation

Warren Gifford requested to merge backend-integration/cc/sort-before-truncate into main

Created by: camdencheek

When we truncate a FileMatch with Limit(), we just chop off any line matches past the number we're limiting to. With merged results, this usually means truncating primarily the second FileMatch's line matches, so for a query like a and b, we might truncate all the line matches of b. This makes things look a little broken in the UI because you can see highlights for a, and also see b on the same line that seems like it should be highlighted, but it's not. By sorting the line matches before truncating, we just remove line matches towards the end of the file, which I think is more intuitive and looks less broken.

Before: Screen Shot 2022-02-03 at 17 52 51

After: Screen Shot 2022-02-03 at 17 53 21

Merge request reports

Loading