Forum Discussion
JGedney
Feb 22, 2024Copper Contributor
search/codesearchresults not able to get more than 2000 results?
when I send a POST API request to "https://MYAZUREINSTANCE/tfs/COLLECTION/MYPROJECT/_apis/search/codesearchresults?api-version=7.0" with this payload {
"searchText": "ext:dll",
"$skip"...
Kidd_Ip
Apr 14, 2025MVP
Seems not but some workaround:
- Pagination with Filters:
- Use additional filters (e.g., file extensions, paths, or timestamps) to narrow down the results into smaller subsets.
- For example, you could filter by specific file types or directories and then query each subset separately.
- Order and Filter by Unique Attributes:
- Sort the results by a unique attribute (e.g., file name or modification timestamp).
- Use the last value from the previous query as a filter for the next query. For example:
- Query 1: $skip=0, $top=1000
- Query 2: Filter results where the unique attribute is greater than the last value from Query 1.
- Batch Queries:
- Divide the search into multiple queries by specifying different repositories or branches if applicable.
- This approach allows you to retrieve results in smaller, manageable batches.
- Custom Script for Iterative Retrieval:
- Write a script to automate the process of querying the API iteratively, applying filters or sorting to retrieve all results in chunks.