Skip to content

search: return accurate match count for multiline matches

Administrator requested to merge rvt/ss-file-match-counts into master

Created by: rvantonder

Multiple line matches can correspond to the same logical match (block of code). There's no way to communicate such logical matches in the searcher protocol, since all matches are calculated from len(lineMatches) per file. This affects structural search, see #9426. It is also a problem for our regexp functionality that can include newlines \ns, but I'm not dealing with making those result counts accurate in this PR.

This PR adds a matchCount for FileMatch to the frontend <-> searcher protocol, which is then used to calculate the number of results, instead of len(lineMatches), and returns the correct count for structural searches in the top left of the webapp. Example:

Screen Shot 2020-04-03 at 12 13 38 AM

As you can see, this does not address the number of matches reported on the right hand side of the expand tab, which says Show 33 more matches. That 33 number is derived directly from len(lineMatches), and to fix, we need to expose the matchCount here to the GQL API and then update the webapp. I may do that later, but for now this PR is much better than the current state.

Merge request reports

Loading