From 075f57e7287778c7c83c3a2e80186a4e57d77710 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Wed, 16 Dec 2020 10:41:45 -0500 Subject: [PATCH] fix: #9117, lower query before search --- src/controllers/admin/users.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/controllers/admin/users.js b/src/controllers/admin/users.js index 99f3d4231b..56cdd93abf 100644 --- a/src/controllers/admin/users.js +++ b/src/controllers/admin/users.js @@ -148,7 +148,7 @@ usersController.search = async function (req, res) { if (!query || query.length < 2) { return []; } - hardCap = hardCap || resultsPerPage * 10; + query = String(query).toLowerCase(); if (!query.endsWith('*')) { query += '*'; } @@ -156,7 +156,7 @@ usersController.search = async function (req, res) { const data = await db.getSortedSetScan({ key: searchBy + ':sorted', match: query, - limit: hardCap, + limit: hardCap || (resultsPerPage * 10), }); return data.map(data => data.split(':').pop()); },