I am trying to get the occurrence count of Dialog(
in my repository using SourceGraph API via curl. I am using regex in search. It doesn't seem to work as it returns resultCount
as 0
Curl request:
curl -H 'Authorization: token API_TOKEN' -d '{"query":"query($query: String!) { search(query: $query patternType:regexp) { results { matchCount } } }","variables":{"query":"lang:kotlin case:yes -file:core_ds_component/*|app_ds_catalog/* repo:github.com/username/repo content:^[\\\\x20\\\\t]+Dialog\\\\("}}' https://sourcegraph.com/.api/graphql
Output:
{"data":{"search":{"results":{"resultCount":0}}}}%
However, it works just fine in SourceGraph API console. Here is how the query looks like in the SourceGraph API console search bar:
repo:^github\.com/username/repo$ -file:core_ds_component/*|app_ds_catalog/* content:^[\x20\t]+Dialog\( lang:kotlin
It returns the expected result of 8
as count in the console.
Note: I have enabled case-insensitive and regex search in the bar options. Screenshot
I am probably doing something wrong in designing the curl request corresponding to the GraphQL search query. Could someone please guide me?