@@ -140,32 +140,32 @@ export const SORT_KEYS: SortKeyConfig[] = [
140140 { key : 'downloads-year' , defaultDirection : 'desc' , disabled : true } ,
141141 { key : 'updated' , defaultDirection : 'desc' } ,
142142 { key : 'name' , defaultDirection : 'asc' } ,
143- { key : 'quality' , defaultDirection : 'desc' } ,
144- { key : 'popularity' , defaultDirection : 'desc' } ,
145- { key : 'maintenance' , defaultDirection : 'desc' } ,
146- { key : 'score' , defaultDirection : 'desc' } ,
143+ // quality/popularity/maintenance: npm returns 1 for all, Algolia returns synthetic values.
144+ // Neither provider produces meaningful values for these.
145+ { key : 'quality' , defaultDirection : 'desc' , disabled : true } ,
146+ { key : 'popularity' , defaultDirection : 'desc' , disabled : true } ,
147+ { key : 'maintenance' , defaultDirection : 'desc' , disabled : true } ,
148+ // score.final === searchScore (identical to relevance), redundant sort key
149+ { key : 'score' , defaultDirection : 'desc' , disabled : true } ,
147150]
148151
149152/**
150153 * Sort keys each search provider can meaningfully sort by.
151154 *
152- * Algolia: has download counts and dates but synthetic/zeroed score values
153- * - quality is 0 or 1 (boolean `popular` flag), maintenance is always 0, score is always 0
154- * - popularity is `downloadsRatio` (a meaningful float)
155+ * Both providers support: relevance (server-side order), updated, name.
155156 *
156- * npm: has real score values and dates but no download counts in search results
157+ * Algolia: has `downloadsLast30Days` for download sorting.
158+ *
159+ * npm: the search API now includes `downloads.weekly` and `downloads.monthly`
160+ * directly in results, so download sorting works here too.
161+ *
162+ * Neither provider returns useful quality/popularity/maintenance/score values:
163+ * - npm returns 1 for all detail scores, and score.final === searchScore (= relevance)
164+ * - Algolia returns synthetic values (quality: 0|1, maintenance: 0, score: 0)
157165 */
158166export const PROVIDER_SORT_KEYS : Record < 'algolia' | 'npm' , Set < SortKey > > = {
159- algolia : new Set < SortKey > ( [ 'relevance' , 'downloads-week' , 'updated' , 'name' , 'popularity' ] ) ,
160- npm : new Set < SortKey > ( [
161- 'relevance' ,
162- 'updated' ,
163- 'name' ,
164- 'quality' ,
165- 'popularity' ,
166- 'maintenance' ,
167- 'score' ,
168- ] ) ,
167+ algolia : new Set < SortKey > ( [ 'relevance' , 'downloads-week' , 'updated' , 'name' ] ) ,
168+ npm : new Set < SortKey > ( [ 'relevance' , 'downloads-week' , 'updated' , 'name' ] ) ,
169169}
170170
171171/** All valid sort keys for validation */
0 commit comments