atomic-algolia icon indicating copy to clipboard operation
atomic-algolia copied to clipboard

[BUG] Records always determined to require update

Open swamidass opened this issue 2 years ago • 0 comments

This script never sees records as unchanged if the index is configured not to return all attribute by default. This can be fixed by changing getRemoteIndex to this implementation:

async function  getRemoteIndex(index) {
  let hits = [];
  await index.browseObjects({
    query: '', // Empty query will match all records
    batch: batch => {
      hits = hits.concat(batch);
    },
    attributesToRetrieve: ["*"]
  })
  return hits
}

And, of course, bump the algoliasearch version to >=4 on package.json.

swamidass avatar Feb 25 '22 17:02 swamidass