Repository navigation
Remove Laya integration and add Japanese keyword and query handling - #40
Conversation
Measured on real knowledge bases, the Laya features did not beat the heuristics they replaced: duplicate judgments scored unrelated pairs as high as paraphrases, auto-categorization was less accurate than always picking the most common category, and reranking lowered the top-1 hit rate on Japanese queries. Remove the daemon, its configuration, the LK_LAYA / LK_NO_LAYA variables, and the Laya status in lk stats and MCP get_stats. Keep the Japanese handling that proved useful without a model: - Auto-extracted keywords add up to 3 Japanese terms (mostly kanji compounds) on top of the 8 ASCII / katakana keywords, so Japanese notes get Japanese keywords without pushing out English identifiers. The default --regen threshold follows the new cap of 11. - Search splits a pasted Japanese sentence into the ASCII words, katakana words, and kanji compounds in it. Such a query used to reach FTS as one long phrase and return nothing. Tokens without hiragana are kept as typed, so keyword-style queries behave as before.
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (15)
💤 Files with no reviewable changes (6)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe changes remove Laya configuration, daemon support, and command and MCP integrations. They add Japanese query-term expansion and keyword handling. Search results retain lexical ordering. ChangesLaya removal and Japanese search
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Feature Sequence Diagram(s)sequenceDiagram
participant SearchCommand
participant search_entries
participant query_terms
participant SearchPaths
SearchCommand->>search_entries: Submit query
search_entries->>query_terms: Expand Japanese sentence terms
query_terms-->>search_entries: Return expanded terms
search_entries->>SearchPaths: Use expanded text for FTS, keyword, and LIKE queries
SearchPaths-->>SearchCommand: Return matching entries
Merge Risk: ⚪ Minimal · up to This change removes the optional Laya integration and adds model-free Japanese sentence search and keyword extraction. Japanese sentence queries are split into terms, and short kanji terms are still found through the existing fallback matching. English keyword queries are unchanged. Old Laya settings in config files are ignored without breaking loading. No blocking issues were identified. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
What
Why
Measured on personal knowledge bases (lk's own plus a couple of others), with 28 Japanese sentence queries and 28 English keyword queries written against their entries:
noulscored unrelated pairs 0.97-0.99, the same as paraphrases. Other question forms did not separate them either (AUC 0.54 / 0.63 for old vs. new versions of the same entry against distinct but similar entries).Changes
src/laya.rs,scripts/laya_server.py, the[laya]config,LK_LAYA/LK_NO_LAYA, reranking andsemantic_score, auto category, and the Laya status inlk stats/ MCPget_stats.[laya]section in a config file is ignored like any unknown key.add_knowledgeauto-extracts keywords when none are given.src/keywords.rs:extract_keywordsadds up to 3 Japanese terms (mostly kanji compounds such as排他制御) on top of the 8 ASCII / katakana keywords. Against curated keywords, recall of the Japanese ones went from 0.18 to 0.45, and overall precision from 0.53 to 0.44.query_terms: a whitespace-separated token containing hiragana is split into the ASCII words, katakana words, and kanji compounds in it. Tokens without hiragana are kept as typed.src/db.rs:search_entriesruns the query throughquery_terms, so both the CLI and MCP search get it.src/main.rs: the default--thresholdoflk keywords --regenfollows the new cap (8 -> 11).README.md: drop the Laya docs and describe the keyword and query handling.Tests
cargo test: 237 unit / 136 integration passed (1 pre-existing ignored).cargo clippy --all-targetsandcargo fmt --check: clean.test_query_terms_*,test_extract_keywords_adds_japanese_terms,test_extract_keywords_caps_japanese_terms,test_extract_keywords_english_only_is_unchanged, andtest_search_with_japanese_sentence_query.Summary by CodeRabbit