From 8a9258e1975c547d40bd0c221524b2d859b01adf Mon Sep 17 00:00:00 2001 From: Jon Church Date: Tue, 14 Apr 2026 05:44:10 -0400 Subject: [PATCH] fix: use owners.name facet for user profile pkgs --- app/composables/npm/useAlgoliaSearch.ts | 10 +++++----- app/composables/npm/useUserPackages.ts | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/composables/npm/useAlgoliaSearch.ts b/app/composables/npm/useAlgoliaSearch.ts index a6ba645e18..02ce461517 100644 --- a/app/composables/npm/useAlgoliaSearch.ts +++ b/app/composables/npm/useAlgoliaSearch.ts @@ -161,8 +161,8 @@ export function useAlgoliaSearch() { } } - /** Fetch all packages for an owner using `owner.name` filter with pagination. */ - async function searchByOwner( + /** Fetch all packages for a maintainer using `owners.name` filter with pagination. */ + async function searchByMaintainer( ownerName: string, options: { maxResults?: number } = {}, ): Promise { @@ -185,7 +185,7 @@ export function useAlgoliaSearch() { query: '', offset, length, - filters: `owner.name:${ownerName}`, + filters: `owners.name:${ownerName}`, analyticsTags: ['npmx.dev'], attributesToRetrieve: ATTRIBUTES_TO_RETRIEVE, attributesToHighlight: [], @@ -286,7 +286,7 @@ export function useAlgoliaSearch() { requests.push({ indexName, query: '', - filters: `owner.name:${checks.name}`, + filters: `owners.name:${checks.name}`, length: 1, analyticsTags: ['npmx.dev'], attributesToRetrieve: EXISTENCE_CHECK_ATTRS, @@ -347,7 +347,7 @@ export function useAlgoliaSearch() { return { search, searchWithSuggestions, - searchByOwner, + searchByMaintainer, getPackagesByName, } } diff --git a/app/composables/npm/useUserPackages.ts b/app/composables/npm/useUserPackages.ts index 59577cefaf..ed9f859382 100644 --- a/app/composables/npm/useUserPackages.ts +++ b/app/composables/npm/useUserPackages.ts @@ -28,7 +28,7 @@ export function useUserPackages(username: MaybeRefOrGetter) { }) // this is only used in npm path, but we need to extract it when the composable runs const { $npmRegistry } = useNuxtApp() - const { searchByOwner } = useAlgoliaSearch() + const { searchByMaintainer } = useAlgoliaSearch() // --- Incremental loading state (npm path) --- const currentPage = shallowRef(1) @@ -58,7 +58,7 @@ export function useUserPackages(username: MaybeRefOrGetter) { // --- Algolia: fetch all at once --- if (provider === 'algolia') { try { - const response = await searchByOwner(user) + const response = await searchByMaintainer(user) // Guard against stale response (user/provider changed during await) if (user !== toValue(username) || provider !== searchProviderValue.value) {