Expand description
CJK-aware graph search (Rust-side segmentation; no schema change). CJK-aware graph search (Rust-side segmentation, no schema change).
The bundled FTS5 table uses the trigram tokenizer, which matches poorly
for short CJK queries (a 1–2 character Japanese/Korean query produces no
usable trigram). This module adds a parallel CJK search path that:
- Segments the query in Rust — each CJK character becomes its own token,
Latin/digit runs stay intact (
segment_cjk). - Matches tokens as substrings (
LIKE '%tok%') againsttitle,body, andtags, requiring every token to be present (AND semantics), ranked by importance.
Because this is plain LIKE over the existing columns, it touches no
SQLite DDL — init_graph_schema is identical with or without graph-cjk,
so a database created without the feature is safe to use with it and
vice-versa. The cost is a scan per query (no FTS index), acceptable for the
small-to-medium graphs this foundation targets.
Functions§
- search_
nodes_ cjk - Search nodes for a CJK (or mixed) query via contiguous substring matching.
- segment_
cjk - Insert a space after every CJK character so whitespace tokenization treats each CJK character as a separate token. Latin/digit/punctuation runs and existing whitespace are left untouched.