Repository navigation
Commit 688fddb
fix(knowledge): the keyword leg keeps 々, 〆 and 〇 inside an unspaced run (#38498)
<!-- claude-projects-attribution: {"github_login":"os-project-manager"}
-->
_Requested by **Leehom** · [project
thread](https://claude.ai/code/project/chan_01TenzsRopZj4jMbvjX8uz1X?thread=cmsg_01TenzsRopZj4jMbvjX8uz1XJFhX5XfWT8anspjCw9gfjz)_
Part of #38411. This PR is the follow-up to #38469: the separator marks
found in its review. Still open on the card: the BrightRule model-graded
eval and Ask 3.
Clause-②: no
Metadata-protocol: none
## 维护者速读
-
用户能看到什么变化:中文、日文提问里的「々」「〆」「〇」不再把词切断,「人々」「二〇二四年」这类写法在知识检索的关键词一路能被匹配到;其他提问不变。
- 为什么做:知识平台专题,上一个中日韩关键词改动在审核中发现的遗漏。
- 出错会怎样:最坏情况是含这三个符号的提问关键词排序变差,向量一路照常作答;不改索引、不需重建,可直接撤回。
- 要你做什么:无。
## What changes
- `keywordTerms` in `knowledge-turso/src/sql.ts` and
`knowledge-pgvector/src/sql.ts` (one rule, kept identical) split a query
at the whole CJK symbols block (` -〿`). That block also holds three
marks written inside a word: 々 (U+3005), 〆 (U+3006) and 〇 (U+3007). A
mark split the run it sat in, and a run of one character is then
dropped, so 「人々」 gave no term and 「二〇二四年」 lost its first pieces. The
split class is now ` -〄〈-〿`, and the three marks are named in
`UNSEGMENTED_RUN`, whatever their script: 々 and 〇 are Han, 〆 is Common.
「、」, 「。」 and the brackets still split.
- pgvector's `UNSEGMENTED` (which keeps a term off the `tsvector`) gains
the same three marks, so a piece made only of 〆 is matched as a
substring, not as a word.
- New changeset `.changeset/38411-cjk-separator-marks.md` (patch, both
stores). The #38469 changeset is left as main has it.
## Tests
<details><summary>Pins, ablation, type check</summary>
- New pin in both stores: 「人々」 gives `['人々']`; 「二〇二四年」 gives `['二〇二',
'〇二四', '二四年', '二〇', '〇二', '二四', '四年']`; 「〆切日」 gives `['〆切日', '〆切',
'切日']`; 「出差、住宿。审批」 gives `['出差', '住宿', '审批']`. pgvector also pins
`isWordTerm('〆〆〆') === false`.
- knowledge-turso: `Test Files 4 passed (4)`, `Tests 286 passed (286)`.
knowledge-pgvector without a database: `Test Files 4 passed | 7 skipped
(11)`, `Tests 20 passed | 91 skipped (111)`. Type check of both: green.
One run under the verify lock: `VERDICT command-exit 0`.
- Ablation: both `sql.ts` set to the merge base (blob hashes checked),
the pins run, then both restored and their hashes checked again. turso:
`Tests 2 failed` (the new pin, on `:memory:` and `file:`). pgvector:
`Tests 2 failed | 4 passed (6)` (the new pin and the `〆〆〆` pin).
- NOT MEASURED: the live pgvector suite, reason: no PostgreSQL in this
container for this follow-up. CI covers it.
</details>
## Verification
- Read first: `packages/plugins/knowledge-turso/src/sql.ts`
(`UNSEGMENTED_RUN` and the split class in `keywordTerms`).
- Two-minute check: `pnpm --filter @objectstack/knowledge-turso exec
vitest run --maxWorkers=2 src/__tests__/acceptance.test.ts -t 'keeps 々'`
should show the pin passing twice.
<details><summary>Local gate subset at 86a724b (CI runs the full
farm)</summary>
- `node scripts/pm/dispatch-gates.mjs --commands` derived 66 families
for the 5 changed files. Each was run with its exit code captured before
any pipe: **62 exit 0**. `--ran` reconciliation: `66 derived, 62 run, 2
NOT-MEASURED, 2 UNRUN`.
- NOT MEASURED: `check-plugin-teardown-shape.mjs --self-test` and
`check:dual-build-cjs-loads`, reason: exit 3, PREREQUISITE NOT MET
(shallow clone; not every package has a `dist/`).
- NOT MEASURED: `check:query-options-erasure` and
`check:type-check-debt`, reason: repo-wide scans stopped by the 240 s
per-gate limit (exit 124). CI's Lint & Repo Gates and TypeScript Type
Check run them.
- `overlap-check`: `VERDICT clean exit 0` against origin/main 430bbbf
(no open PR shares a file).
- Self-scan of the changed files for control bytes: no hits.
</details>
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01FEkQ5pfJqySEaVD3CKvevm
<!-- signed: repo:objectstack#5 · os-project-manager ·
session_01FEkQ5pfJqySEaVD3CKvevm -->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 97fad97 commit 688fddb
5 files changed
Lines changed: 43 additions & 9 deletions
File tree
- .changeset
- packages/plugins
- knowledge-pgvector/src
- __tests__
- knowledge-turso/src
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
43 | 51 | | |
44 | 52 | | |
45 | 53 | | |
46 | 54 | | |
| 55 | + | |
| 56 | + | |
47 | 57 | | |
48 | 58 | | |
49 | 59 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
139 | | - | |
140 | | - | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
141 | 142 | | |
142 | | - | |
| 143 | + | |
143 | 144 | | |
144 | 145 | | |
145 | 146 | | |
146 | 147 | | |
147 | | - | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
148 | 151 | | |
149 | | - | |
| 152 | + | |
150 | 153 | | |
151 | 154 | | |
152 | 155 | | |
| |||
174 | 177 | | |
175 | 178 | | |
176 | 179 | | |
177 | | - | |
| 180 | + | |
178 | 181 | | |
179 | 182 | | |
180 | 183 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1010 | 1010 | | |
1011 | 1011 | | |
1012 | 1012 | | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
1013 | 1021 | | |
1014 | 1022 | | |
1015 | 1023 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
394 | 394 | | |
395 | 395 | | |
396 | 396 | | |
397 | | - | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
398 | 400 | | |
399 | | - | |
| 401 | + | |
400 | 402 | | |
401 | 403 | | |
402 | 404 | | |
| |||
423 | 425 | | |
424 | 426 | | |
425 | 427 | | |
426 | | - | |
| 428 | + | |
427 | 429 | | |
428 | 430 | | |
429 | 431 | | |
| |||
0 commit comments