From a49ee3fddf6cfabdf4a8ee5012efa90df7e9d526 Mon Sep 17 00:00:00 2001 From: Anton Shepilov Date: Mon, 26 Feb 2024 19:22:44 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9BFix=20paging=20in=20search=20(#377)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../platform/services/search/adapters/mongosearch/index.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tdrive/backend/node/src/core/platform/services/search/adapters/mongosearch/index.ts b/tdrive/backend/node/src/core/platform/services/search/adapters/mongosearch/index.ts index a3843e687..c8cc6f384 100644 --- a/tdrive/backend/node/src/core/platform/services/search/adapters/mongosearch/index.ts +++ b/tdrive/backend/node/src/core/platform/services/search/adapters/mongosearch/index.ts @@ -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}`);