Skip to content

Commit 1c9df3b

Browse files
committed
quick improve
1 parent 2099e51 commit 1c9df3b

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

app/composables/useNpmRegistry.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,23 @@ async function searchNpmPackages(
167167
indexName: 'npm-search',
168168
params: {
169169
query,
170-
hitsPerPage: options.size || 20,
171-
page: options.from ? Math.floor(options.from / (options.size || 20)) : 0,
170+
offset: options.from,
171+
length: options.size,
172172
filters: '',
173173
analyticsTags: ['npmx.dev'],
174+
attributesToRetrieve: [
175+
'name',
176+
'version',
177+
'description',
178+
'modified',
179+
'homepage',
180+
'repository',
181+
'owners',
182+
'downloadsRatio',
183+
'popular',
184+
],
185+
// TODO: actually use this in PackageCard, but requires the splitting and re-joining logic as in InstantSearch and conditional based on ALGOLIA boolean
186+
attributesToHighlight: ['name', 'description'],
174187
},
175188
},
176189
])

0 commit comments

Comments
 (0)