Skip to content

Commit

Permalink
Merge pull request #19 from beckerjohannes/fix/more-than-thousand-ele…
Browse files Browse the repository at this point in the history
…ments

Fixed #16 getRemoteIndex does not seem to resolve …
  • Loading branch information
chrisdmacrae committed Jul 23, 2020
2 parents 6dfab0e + 5d818b0 commit e8ddc98
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/utils/getRemoteIndex.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,18 @@ module.exports = async function getRemoteIndex(index) {
}

function query(index) {
return new Promise(function(resolve, reject) {
index.browse("", {}, function browseDone(err, content, hits) {
return new Promise(function(resolve, reject) {
hits = [];
index.browse("", {}, function browseDone(err, content) {
if (err) reject(err);

if (!Array.isArray(hits)) {
hits = []
}


content.hits.forEach(function(hit) {
hit.objectID = String(hit.objectID)
hits.push(hit)
})

if (content.cursor) {
resolve(index.browseFrom(content.cursor, browseDone, hits))
index.browseFrom(content.cursor, browseDone);
} else {
resolve(hits)
}
Expand Down

0 comments on commit e8ddc98

Please sign in to comment.