4

クラス (2500 レコード) を Parse.com から Algolia インデックスにインポートしようとしています。デフォルトでは 100 レコードの制限があり、これは明らかに機能していません。使ってもquery.limit = 1000;

以下のコードを使用してクラス全体をインポートするにはどうすればよいですか?

Parse.Cloud.define("createIndex", function(request, response) {

var algoliasearch = require('cloud/algoliasearch.parse.js');
var client = algoliasearch('9PsdfsdWVU7', '3b24e897bfb4esdfsdfsdf209e25c28');
var index = client.initIndex('exercises');

console.log("running");

var objectsToIndex = [];

//Create a new query for Contacts
var query = new Parse.Query('Exercises');

query.limit = 1000;
// Find all items
query.find({
    success: function(exercises) {
        // prepare objects to index from contacts
        objectsToIndex = exercises.map(function(exercise) {
            // convert to regular key/value JavaScript object
            exercise = exercise.toJSON();

            // Specify Algolia's objectID with the Parse.Object unique ID
            exercise.objectID = exercise.objectId;

            return exercise;
        });

        // Add or update new objects
        index.saveObjects(objectsToIndex, function(err, content) {
            if (err) {
                throw err;
            }

            console.log('Parse<>Algolia import done');
        });
        response.success("worked");
    },
    error: function(err) {
        response.error("failed");
        throw err;
    }
});

});
4

1 に答える 1