From 83d3f4bd2140e577dee856488325b30124162f72 Mon Sep 17 00:00:00 2001 From: r266-tech Date: Fri, 30 Jan 2026 14:56:10 +0800 Subject: [PATCH] fix: support Unicode characters in hybrid search FTS query The previous regex /[A-Za-z0-9_]+/g only matched ASCII characters, causing CJK (Chinese/Japanese/Korean) and other non-ASCII Unicode characters to be completely ignored during hybrid search. Changed to /[\p{L}\p{N}_]+/gu which uses Unicode property escapes: - \p{L} matches all Unicode letters (including CJK) - \p{N} matches all Unicode numbers - u flag enables Unicode mode This ensures hybrid search works correctly with Chinese, Japanese, Korean, and other non-Latin scripts. --- src/memory/hybrid.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/memory/hybrid.ts b/src/memory/hybrid.ts index 753748bf9..0f86f4c6d 100644 --- a/src/memory/hybrid.ts +++ b/src/memory/hybrid.ts @@ -23,7 +23,7 @@ export type HybridKeywordResult = { export function buildFtsQuery(raw: string): string | null { const tokens = raw - .match(/[A-Za-z0-9_]+/g) + .match(/[\p{L}\p{N}_]+/gu) ?.map((t) => t.trim()) .filter(Boolean) ?? []; if (tokens.length === 0) return null;