algolia/algoliasearch-client-node

Batch is broken.

Closed this issue · 2 comments

I just saw this commit: 69b09fa, _batch is called with 4 parameters.

But in the current implementation:
https://github.com/algolia/algoliasearch-client-node/blob/V1/src/algoliasearch-node.js#L1350

_batch: function(objects, action, callback) {
  var postObj = {requests:[]};
  for (var i = 0; i < objects.length; ++i) {
    var request = { action: action,
    body: objects[i] };
    if (!_.isUndefined(objects[i].objectID)) {
      request.objectID = objects[i].objectID;
    }
    postObj.requests.push(request);
  }
  this.as._request('POST', '/1/indexes/' + encodeURIComponent(this.indexName) + '/batch', postObj, 'write', callback);
},

Batch is accepting just 3 parameters. This gives me TypeError: string is not a function when I try to call the function that use _batch. Are you guys are on the ongoing of new implementation?

Sorry for my English :).

vvo commented

good catch @deoxen0n2, going to publish a patch

vvo commented

Ok, landed as 1.8.3 @deoxen0n2