From 94f96508491d22859c1353eda353cb39cb3c0c1d Mon Sep 17 00:00:00 2001 From: Brian Fletcher Date: Mon, 21 Aug 2023 09:21:17 +0100 Subject: [PATCH] Imporve consistency of results from azure provider The search feature does not produce consistent results across api pages. This seems to be more likely if the pages are sorted by rank. This changes the sort order, in order to make the pages a little bit more consistent as the search index in azure changes. Signed-off-by: Brian Fletcher --- .changeset/fair-paws-flash.md | 5 +++++ plugins/catalog-backend-module-azure/src/lib/azure.ts | 6 ++++++ 2 files changed, 11 insertions(+) create mode 100644 .changeset/fair-paws-flash.md diff --git a/.changeset/fair-paws-flash.md b/.changeset/fair-paws-flash.md new file mode 100644 index 0000000000..d9a7b1827e --- /dev/null +++ b/.changeset/fair-paws-flash.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-catalog-backend-module-azure': patch +--- + +Improve consistency of results from the `AzureDevOpsEntityProvider`. diff --git a/plugins/catalog-backend-module-azure/src/lib/azure.ts b/plugins/catalog-backend-module-azure/src/lib/azure.ts index 916d70a9fa..74667c5465 100644 --- a/plugins/catalog-backend-module-azure/src/lib/azure.ts +++ b/plugins/catalog-backend-module-azure/src/lib/azure.ts @@ -64,6 +64,12 @@ export async function codeSearch( method: 'POST', body: JSON.stringify({ searchText: `path:${path} repo:${repo || '*'} proj:${project || '*'}`, + $orderBy: [ + { + field: 'path', + sortOrder: 'ASC', + }, + ], $skip: items.length, $top: PAGE_SIZE, }),