Skip to content

Commit d9046d6

Browse files
RerankerGuoharvey_xiangsonimwangCarltonXiang
authored
fix: quote OpenClaw FTS query terms (#2043)
* docs(cn): translate remaining English text in dream.md * chore: update github workflow stale.yaml * fix: quote OpenClaw FTS query terms --------- Co-authored-by: harvey_xiang <harvey_xiang22@163.com> Co-authored-by: sonimwang <17816198144@163.com> Co-authored-by: HarveyXiang <harvey_xiang@163.com>
1 parent 713ed02 commit d9046d6

4 files changed

Lines changed: 22 additions & 6 deletions

File tree

.github/workflows/stale.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ jobs:
2020
close-pr-message: 'This PR has been automatically closed due to inactivity.'
2121
days-before-stale: 30 # Days of inactivity before marking as stale
2222
days-before-close: 7 # Days of inactivity before closing stale issues/PRs
23-
stale-issue-label: 'stale'
24-
stale-pr-label: 'stale'
25-
exempt-issue-labels: 'do not close'
26-
exempt-pr-labels: 'do not close'
23+
stale-issue-label: 'status:stale'
24+
stale-pr-label: 'status:stale'
25+
exempt-issue-labels: 'status:do not close'
26+
exempt-pr-labels: 'status:do not close'
2727
remove-stale-when-updated: true

apps/memos-local-openclaw/src/storage/sqlite.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3031,7 +3031,7 @@ function sanitizeFtsQuery(raw: string): string {
30313031
.filter((t) => t.length > 1)
30323032
.filter((t) => !FTS_RESERVED.has(t.toUpperCase()));
30333033

3034-
return tokens.join(" ");
3034+
return tokens.map((t) => `"${t.replace(/"/g, '""')}"`).join(" ");
30353035
}
30363036

30373037
const FTS_RESERVED = new Set(["AND", "OR", "NOT", "NEAR"]);

apps/memos-local-openclaw/tests/storage.test.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,22 @@ describe("SqliteStore", () => {
106106
expect(results.length).toBeGreaterThanOrEqual(1);
107107
});
108108

109+
it("should handle FTS queries containing message ids and CJK text", () => {
110+
store.insertChunk(
111+
makeChunk({
112+
id: "c1",
113+
content: "message_id om_x100b544a390604b8c3e1b7d8641f08e 我要测试",
114+
summary: "message id trace",
115+
}),
116+
);
117+
118+
const results = store.ftsSearch(
119+
"message_id om_x100b544a390604b8c3e1b7d8641f08e 我要测试",
120+
10,
121+
);
122+
expect(Array.isArray(results)).toBe(true);
123+
});
124+
109125
it("should get neighbor chunks", () => {
110126
const now = Date.now();
111127
store.insertChunk(makeChunk({ id: "c1", turnId: "t1", seq: 0, createdAt: now }));

docs/cn/open_source/modules/dream.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ Dream 模拟这一点:从*未完成的内在动机*出发,而不是从原始
7979
```json
8080
{
8181
"motive_id": "motive:dream_memory_strategy_alignment",
82-
"description": "Several conversations failed for the same hidden reason: weekly reporting, future planning, and filter design were treated as separate tasks, while the user needed a shared strategic narrative.",
82+
"description": "几次对话失败,背后是同一个隐藏原因:周报、未来规划和 filter 设计被当成三个独立任务,而用户需要的是一条统一的战略叙事。",
8383
"memory_ids": ["weekly_report_thread", "future_planning_thread", "filter_design_thread"]
8484
}
8585
```

0 commit comments

Comments
 (0)