insights: Add capture group aggregation
Created by: CristinaBirkel
Closes https://github.com/sourcegraph/sourcegraph/issues/40211
Description
This adds in capture group aggregation. I copied over some functionality primarily from the compute
package, but made a couple small modifications. I don't think we want to take an actual dependency on compute
for this in any case.
Let me know if you can think of anything else we need to add here for now--I think it's in a pretty good state though to start testing and make sure it integrates with FE, and we can plan to iterate on edge cases?
Test plan
So far, testing locally, I get a lot of timeouts. But here's a query that worked for me:
{
searchQueryAggregate(query:"query(s.*)$", patternType: regexp) {
aggregations(mode: CAPTURE_GROUP, limit: 10) {
__typename
... on ExhaustiveSearchAggregationResult {
groups {
label
count
query
}
otherResultCount
otherGroupCount
}
... on SearchAggregationNotAvailable {
reason
}
}
}
}
How else should we be testing this? It looks as expected to me, but let me know what you think!