Open fleed opened 5 years ago
Hi - Here are examples of using filters in code search API- https://docs.microsoft.com/en-us/rest/api/azure/devops/search/code%20search%20results/fetch%20code%20search%20results?view=azure-devops-rest-5.0#examples
Please let me know if there is anything you want us to improve in the documentation?
Well.. I cannot find the options for filtering. Example: by extension
Respectfully @sandeepchads your response isn't overly helpful as it only provides a link to the example and not to the underlying Filter reference for Search.
Is there a reference to the actual filters object model so we know how to properly construct our searches?
Thanks
After a very long time searching for the answer myself I came across this issue. I could not find any documentation or anything that mentioned what the possible options for filters
were.
However, a bit off-topic, I figured out you can use the searchText
field like inside Azure DevOps web interface, meaning if you want to search for files with extension .cs
you could make a request body like: { "searchText": "Controller ext:.cs" ... }
.
You can check https://docs.microsoft.com/en-us/azure/devops/project/search/advanced-code-search-syntax?view=azure-devops for more search text filters.
This does not fix the problem at hand though.
@sandeepchads maybe add the possible options for the filters
option or show how searchText
can be utilized since at the moment the link just states
Name | Type | Description |
---|---|---|
... | ... | ... |
filters | object | Filters to be applied. Set it to null if there are no filters to be applied. |
searchText | string | The search text. |
and it might end up taking the users a long time to figure it out on their own.
The code search syntax link is broken as of this writing. For anyone reaching this discussion I would like to add that you can also use operators in the searchText query, for instance: (ext:.cs OR ext:.config)
The code search results page doesn't contain any information about the supported filters. I'd like to add some filters (e.g. extension)
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.