From b5bcea3eb5faa124aa953e1ca0b6d157402e8f2c Mon Sep 17 00:00:00 2001 From: Mega Yu Date: Tue, 28 Apr 2026 16:40:55 +0800 Subject: [PATCH] fix test --- src/main/frontend/common/search_fuzzy.cljs | 10 +++++----- src/main/frontend/components/cmdk/list_item.cljs | 6 ++++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/main/frontend/common/search_fuzzy.cljs b/src/main/frontend/common/search_fuzzy.cljs index c4a8cd70f6..6737ca1137 100644 --- a/src/main/frontend/common/search_fuzzy.cljs +++ b/src/main/frontend/common/search_fuzzy.cljs @@ -1,11 +1,12 @@ (ns frontend.common.search-fuzzy "fuzzy search. Used by frontend and worker namespaces" - (:require ["remove-accents$default" :as removeAccents] + (:require ["remove-accents" :refer [remove]] ["tiny-pinyin" :as tp] [cljs-bean.core :as bean] [clojure.string :as string])) (def MAX-STRING-LENGTH 1000.0) +(def strip-accents remove) (defn clean-str [s] @@ -37,7 +38,7 @@ (let [s' (if lower-case? (string/lower-case s) s) normalize-str (.normalize s' "NFKC")] (if remove-accents? - (removeAccents normalize-str) + (strip-accents normalize-str) normalize-str)))) (defn score @@ -104,7 +105,7 @@ (for [item data] (let [strings (->> extract-fns (map (fn [f] (str (f item)))) - (remove string/blank?)) + (cljs.core/remove string/blank?)) best-score (if (seq strings) (apply max (map #(score query %) strings)) 0)] @@ -112,7 +113,6 @@ :score best-score}))))) (map :data))) - (defn- zh-simplified-char? "True for characters in the CJK Unified Ideographs blocks used by Simplified Chinese." @@ -135,7 +135,7 @@ (when (seq seg) (->> (string/replace seg #"[^a-zA-Z0-9 ]" "") (#(string/split % #"\s+")) - (remove string/blank?) + (cljs.core/remove string/blank?) (map #(string/lower-case (subs % 0 1)))))) (defn hanzi->initials diff --git a/src/main/frontend/components/cmdk/list_item.cljs b/src/main/frontend/components/cmdk/list_item.cljs index 308283063a..d359b5298f 100644 --- a/src/main/frontend/components/cmdk/list_item.cljs +++ b/src/main/frontend/components/cmdk/list_item.cljs @@ -1,6 +1,6 @@ (ns frontend.components.cmdk.list-item (:require - ["remove-accents$default" :as removeAccents] + ["remove-accents" :refer [remove]] [clojure.string :as string] [frontend.components.icon :as icon-component] [frontend.handler.block :as block-handler] @@ -8,6 +8,8 @@ [logseq.shui.ui :as shui] [rum.core :as rum])) +(def strip-accents remove) + (defn- to-string [input] (cond (string? input) input @@ -22,7 +24,7 @@ (cond-> (to-string text) ;; :lower-case (string/lower-case) :normalize (.normalize "NFKC") - (:feature/enable-search-remove-accents? app-config) (removeAccents))) + (:feature/enable-search-remove-accents? app-config) (strip-accents))) (defn highlight-query* [app-config query text] (cond