Skip to content

Commit

Permalink
🐛Fix paging in search (#377)
Browse files Browse the repository at this point in the history
  • Loading branch information
shepilov authored Feb 26, 2024
1 parent 2cf553e commit a49ee3f
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,10 @@ export default class MongoSearch extends SearchAdapter implements SearchAdapterI
}
}

const limit = parseInt(options.pagination.limitStr);
const nextToken =
entities.length === parseInt(options.pagination.limitStr) &&
(parseInt(options.pagination.page_token || "0") + 1).toString(10);
entities.length === limit &&
(parseInt(options.pagination.page_token || "0") + limit).toString(10);
const nextPage: Paginable = new Pagination(nextToken, options.pagination.limitStr || "100");

logger.info(`Found ${entities.length} results on entity ${searchPrefix}${index}`);
Expand Down

0 comments on commit a49ee3f

Please sign in to comment.