From 66a42257c3ba2566db9d2bb8868cd01aa19f6006 Mon Sep 17 00:00:00 2001 From: lyg <1543117173@qq.com> Date: 星期三, 12 六月 2024 20:56:52 +0800 Subject: [PATCH] 修改搜索关键字处理逻辑 --- src/main.mjs | 8 +++----- 1 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/main.mjs b/src/main.mjs index cc3d0e5..32fafd9 100644 --- a/src/main.mjs +++ b/src/main.mjs @@ -99,14 +99,12 @@ * @returns 澶勭悊鍚庣殑鍏抽敭瀛� */ function formatKw(text, titleWithNumbers) { - // 鍙繚鐣欑┖鏍笺�佷腑鏂囥�佽嫳鏂囥�佹硶鏂囥�佸痉鏂囥�佸笇鑵婃枃 - const regex = /[^\u4e00-\u9fa5\w\s\d]/g; if (titleWithNumbers) { - text = text.replace(/[^\u4e00-\u9fa5a-zA-Z\u00c0-\u024f \d]/g, ""); + text = text; } else { - text = text.replace(/[^\u4e00-\u9fa5a-zA-Z\u00c0-\u024f ]/g, ""); + text = text.replace(/[\d]/g, ""); } - text = text.split(' ').slice(0, 10).join("+"); + text = text.split(' ').slice(0, 6).join("+"); return text; } -- Gitblit v1.9.1