Skip to content

Search API: experimentally expose ChunkMatches over GraphQL

Administrator requested to merge backend-integration/cc/chunk-graphql into main

Created by: camdencheek

This experimentally adds ChunkMatches to our search resolvers which enables returning multiline matches from the GraphQL API. This is marked as experimental because I haven't hooked it up to anything and the field might still change after trying to use it.

Note that Zoekt still does not return multiline matches, but we convert all our matches into ChunkMatches even if they have been split up into multiple lines. Using this new API should be at least as powerful as the lineMatch API since we do return multiline matches for things like unindexed search and structural search.

I reused the Code Intel Range and Position GraphQL types for this, but a notable difference is that Position does not expose the byte offset. I think this fine since we don't actually need this in any of our clients, but it does somewhat limit the flexibility of the API.

Test plan

Not updating tests until I've also implemented this for the streaming API. It's not used, so backend integration tests should still pass (running for this PR). I'll update tests as I migrate things to use the new API.

However, a screenshot to prove this passes manual smoke tests:

Screen Shot 2022-06-07 at 11 07 37

Merge request reports

Loading