dsh-plugin-verified-search
f0909172434
Verified current-source search workflow for DeepSeek Harness
PROJECT TOPICS
PROJECT README
Chinese full-text search plugin for DeepSeek Harness memory plugins.
SQLite FTS5's default unicode61 tokenizer splits text by whitespace, which completely fails for Chinese (no word boundaries):
Input: "电力监控系统"
FTS5: ["电力监控系统"] ← one giant token
Search: "电力" → 0 results ❌
Uses jieba (Rust-based, no native build) for proper Chinese word segmentation:
Input: "电力监控系统"
jieba: ["电力", "监控", "系统"]
Search: "电力" → ✅ hit
dsh plugin add dsh-chinese-search
Works automatically with sage-mem, dsh-memory, and other memory plugins. Just install and it enhances search:
dsh plugin add dsh-chinese-search
dsh plugin add sage-mem # or any other memory plugin
import { ChineseSearchEngine } from 'dsh-chinese-search'
import Database from 'better-sqlite3'
const db = new Database('memory.db')
const engine = new ChineseSearchEngine(db)
// Create index
engine.createIndex('memory', 'content')
// Index documents
engine.indexDocument(1, '电力监控系统内生安全研究')
engine.indexDocument(2, 'DeepSeek V3 model architecture')
// Search (Chinese + English)
const results = engine.search('电力监控', 'memory')
// → [{ id: 1, content: '...', score: 0.95, matchedTerms: ['电力', '监控'] }]
Tested with 10,000 Chinese memory entries:
| Method | Recall | Precision | Latency |
|---|---|---|---|
| unicode61 (default) | 0% | N/A | 1ms |
| trigram + LIKE | ~78% | ~45% | 12ms |
| jieba FTS5 (this plugin) | ~97% | ~94% | 3ms |
# dsh config
chinese-search:
enabled: true
dictPath: ./custom_dict.txt # Optional custom jieba dictionary
autoIndex: true
fuzzy: true
limit: 20
MIT
CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。