From 79deaf93729b15788a4a19068bb35e9d18492d83 Mon Sep 17 00:00:00 2001 From: polv Date: Mon, 16 Mar 2026 12:44:12 +0700 Subject: [PATCH] fix fts prefix ~ --- package.json | 1 - src-react/src/pages/SearchPage.tsx | 13 ++++++------- src-tauri/tauri.conf.json | 2 +- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index fd24e5e..8db0c24 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,6 @@ { "name": "cjdic2", "private": true, - "version": "0.1.1", "type": "module", "scripts": { "dev:desktop": "cross-env RUST_BACKTRACE=1 tauri dev", diff --git a/src-react/src/pages/SearchPage.tsx b/src-react/src/pages/SearchPage.tsx index c401043..f0a0aaf 100644 --- a/src-react/src/pages/SearchPage.tsx +++ b/src-react/src/pages/SearchPage.tsx @@ -153,9 +153,12 @@ function SearchPage() { }); if (isNew) { - if (!result.length && !isFromSplit && /^[^ ]{3,} $/.test(q)) { + const [s1, prefix = "", s2 = ""] = q.split(/^([\*\?\[\]\~]*)/); + const text = s1 || s2; + + if (!result.length && !isFromSplit && /^[^ ]{3,} $/.test(text)) { const segs = await invoke<{ surface: string }[]>("tokenize", { - text: q, + text, }); if (segs.length > 1) { const newQ = @@ -164,7 +167,7 @@ function SearchPage() { segs.map((s) => s.surface).join("") + " "; - searchParams_setQ(newQ); + searchParams_setQ(prefix + newQ); return; } } @@ -199,10 +202,6 @@ function SearchPage() { set_isScrollEnd(true); return; } - - setTimeout(() => { - target.scrollTop = scrollTop + 100; - }, 100); }; function onSearchboxChange(q: string) { diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 0bc9416..9103d80 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -1,7 +1,7 @@ { "$schema": "https://schema.tauri.app/config/2", "productName": "cjdic2", - "version": "0.1.1", + "version": "0.1.2", "identifier": "cc.polv.cjdic2", "build": { "beforeDevCommand": "pnpm dev",