common/corpus-common-addon/lib/commands/dl-fixtures.js
changeset 339 766af1228b05
parent 326 226d5b17a119
child 454 710a2ae08a74
equal deleted inserted replaced
338:4a3899b6a7ed 339:766af1228b05
    76     dl_themes: function(commandOptions) {
    76     dl_themes: function(commandOptions) {
    77         return this.dl_countmap(commandOptions, 'themes');
    77         return this.dl_countmap(commandOptions, 'themes');
    78     },
    78     },
    79     dl_documents_ids: function(commandOptions, rawArgs, ui) {
    79     dl_documents_ids: function(commandOptions, rawArgs, ui) {
    80 
    80 
    81         var nextPageUrl = commandOptions.url;
    81         var nextPageUrl = commandOptions.url+"?sort=_graph";
    82         var pageIndex = 1;
    82         var pageIndex = 1;
    83         var ids = commandOptions.extra?_.map(commandOptions.extra.split(','), function(id) { return { id: id};}):[];
    83         var ids = commandOptions.extra?_.map(commandOptions.extra.split(','), function(id) { return { id: id};}):[];
    84 
    84 
    85         return promiseWhile(
    85         return promiseWhile(
    86             function() { return pageIndex <= commandOptions.page && nextPageUrl; },
    86             function() { return pageIndex <= commandOptions.page && nextPageUrl; },
    94                     } else if (res.statusCode !== 200) {
    94                     } else if (res.statusCode !== 200) {
    95                         err = new Error('Unexpected status code: ' + res.statusCode);
    95                         err = new Error('Unexpected status code: ' + res.statusCode);
    96                         err.res = res;
    96                         err.res = res;
    97                         return deferred.reject(err);
    97                         return deferred.reject(err);
    98                     }
    98                     }
    99                     nextPageUrl = body.next_page_url;
    99                     nextPageUrl = body.meta.next_page_url;
   100                     pageIndex++;
   100                     pageIndex++;
   101 
   101 
   102                     ids = _.reduce(
   102                     ids = _.reduce(
   103                         body.documents,
   103                         body.documents,
   104                         function(res, doc) {
   104                         function(res, doc) {