I'm using the GitHub Code Search API in a tool I'm building for my organization.
I'd like to provide search functionality throughout our repos so you can search for a word (E.g. "array") and find it in any of the .md
files inside any of the repos in our organization. (The use-case for this tool prevents us from using the in-platform search feature so I need to use the API.)
The problem I'm facing is that I'm getting results from our vendored lib folders. I would like to exclude those.
Is it possible to provide the Search API with an additional parameter to exclude (for example) folders named "lib" from the search results?
Here's an example of the query I'm currently using:
https://api.github.com/search/code?q=user:bradsk88+extension:js+array&per_page=2
I've tried using path:!lib
to no avail:
https://api.github.com/search/code?q=user:bradsk88+extension:js+path:!lib+array&per_page=2
... this gives me no results, despite the word "array" appearing in several of my repos
{
"total_count": 0,
"incomplete_results": false,
"items": []
}
You can add an exclude rule by using -QUALIFIER
:
q=user:bradsk88+extension:js+array+-path:lib
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With