search: return accurate match count for multiline matches
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 \n
s, 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:
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.