fix fts prefix ~

This commit is contained in:
polv committed 2026-03-16 12:44:12 +07:00
1 parent f0cafa450d
commit 79deaf9372
3 files changed
+7 -9

No files matched your search

-1
View File
@@ -1,7 +1,6 @@
{ {
"name": "cjdic2", "name": "cjdic2",
"private": true, "private": true,
"version": "0.1.1",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev:desktop": "cross-env RUST_BACKTRACE=1 tauri dev", "dev:desktop": "cross-env RUST_BACKTRACE=1 tauri dev",
+6 -7
View File
@@ -153,9 +153,12 @@ function SearchPage() {
}); });
if (isNew) { 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", { const segs = await invoke<{ surface: string }[]>("tokenize", {
text: q, text,
}); });
if (segs.length > 1) { if (segs.length > 1) {
const newQ = const newQ =
@@ -164,7 +167,7 @@ function SearchPage() {
segs.map((s) => s.surface).join("") + segs.map((s) => s.surface).join("") +
" "; " ";
searchParams_setQ(newQ); searchParams_setQ(prefix + newQ);
return; return;
} }
} }
@@ -199,10 +202,6 @@ function SearchPage() {
set_isScrollEnd(true); set_isScrollEnd(true);
return; return;
} }
setTimeout(() => {
target.scrollTop = scrollTop + 100;
}, 100);
}; };
function onSearchboxChange(q: string) { function onSearchboxChange(q: string) {
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
"$schema": "https://schema.tauri.app/config/2", "$schema": "https://schema.tauri.app/config/2",
"productName": "cjdic2", "productName": "cjdic2",
"version": "0.1.1", "version": "0.1.2",
"identifier": "cc.polv.cjdic2", "identifier": "cc.polv.cjdic2",
"build": { "build": {
"beforeDevCommand": "pnpm dev", "beforeDevCommand": "pnpm dev",