MicrosoftDocs / vsts-rest-api-specs

MIT License
164 stars 116 forks source link

What are the available filters? #215

Open fleed opened 5 years ago

fleed commented 5 years ago

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.

sandeepchads commented 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?

fleed commented 5 years ago

Well.. I cannot find the options for filtering. Example: by extension

mrpubnight commented 5 years ago

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

haysch commented 4 years ago

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.

crowcoder commented 3 years ago

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)