mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
fix: undefined query showing in searches
This commit is contained in:
@@ -99,11 +99,13 @@ searchController.search = async function (req, res, next) {
|
|||||||
|
|
||||||
async function recordSearch(data) {
|
async function recordSearch(data) {
|
||||||
const { query, searchIn } = data;
|
const { query, searchIn } = data;
|
||||||
|
if (query) {
|
||||||
const cleanedQuery = String(query).trim().toLowerCase().substr(0, 255);
|
const cleanedQuery = String(query).trim().toLowerCase().substr(0, 255);
|
||||||
if (['titles', 'titlesposts', 'posts'].includes(searchIn) && cleanedQuery.length > 2) {
|
if (['titles', 'titlesposts', 'posts'].includes(searchIn) && cleanedQuery.length > 2) {
|
||||||
await db.sortedSetIncrBy('searches:all', 1, cleanedQuery);
|
await db.sortedSetIncrBy('searches:all', 1, cleanedQuery);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async function buildCategories(uid, searchOnly) {
|
async function buildCategories(uid, searchOnly) {
|
||||||
if (searchOnly) {
|
if (searchOnly) {
|
||||||
|
|||||||
Reference in New Issue
Block a user