mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-07 16:12:53 +01:00
fix: #9117, lower query before search
This commit is contained in:
@@ -147,7 +147,7 @@ usersController.search = async function (req, res) {
|
|||||||
if (!query || query.length < 2) {
|
if (!query || query.length < 2) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
hardCap = hardCap || resultsPerPage * 10;
|
query = String(query).toLowerCase();
|
||||||
if (!query.endsWith('*')) {
|
if (!query.endsWith('*')) {
|
||||||
query += '*';
|
query += '*';
|
||||||
}
|
}
|
||||||
@@ -155,7 +155,7 @@ usersController.search = async function (req, res) {
|
|||||||
const data = await db.getSortedSetScan({
|
const data = await db.getSortedSetScan({
|
||||||
key: searchBy + ':sorted',
|
key: searchBy + ':sorted',
|
||||||
match: query,
|
match: query,
|
||||||
limit: hardCap,
|
limit: hardCap || (resultsPerPage * 10),
|
||||||
});
|
});
|
||||||
return data.map(data => data.split(':').pop());
|
return data.map(data => data.split(':').pop());
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user