Skip to content

Commit

Permalink
chore(gatsby-source-npm-package-search): Upgrade algoliasearch (#28671)
Browse files Browse the repository at this point in the history
  • Loading branch information
sidharthachatterjee committed Dec 17, 2020
1 parent f4e90b6 commit b691b69
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/gatsby-source-npm-package-search/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"homepage": "https://github.com/gatsbyjs/gatsby/tree/master/packages/gatsby-source-npm-package-search#readme",
"dependencies": {
"@babel/runtime": "^7.12.5",
"algoliasearch": "^3.35.1",
"algoliasearch": "^4.8.3",
"got": "^8.3.2"
},
"devDependencies": {
Expand Down
12 changes: 6 additions & 6 deletions packages/gatsby-source-npm-package-search/src/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ const searchIndex = client.initIndex(`npm-search`)

exports.browse = ({ ...params }) => {
let hits = []
const browser = searchIndex.browseAll(params)

return new Promise((resolve, reject) => {
browser.on(`result`, content => (hits = hits.concat(content.hits)))
browser.on(`end`, () => resolve(hits))
browser.on(`error`, err => reject(err))
})
searchIndex
.browseObjects({
batch: batch => (hits = hits.concat(batch)),
...params,
})
.then(() => hits)
}

0 comments on commit b691b69

Please sign in to comment.