[建议 / Feature] 会话搜索增加「仅按标题」匹配模式,降低全文搜索噪音 (title-only search for sessions)
Nobody has claimed this yet.
- Dominant language
- No language data
- Stars
- 22
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
功能描述 / Feature description
会话(任务)搜索目前是全文匹配,希望能增加**"仅按标题"的匹配模式**,让用户可以按名字快速定位目标会话。
现状 / Current behavior
在桌面版的历史/任务搜索框中输入关键词时,搜索同时匹配标题和会话内容。实测(桌面版 3.11.2,从应用代码确认)底层查询为:
LOWER(title) LIKE ? OR LOWER(searchable_text) LIKE ? -- searchable_text ≈ 正文前 200K 字符
由于正文内容远多于标题,一个常见词会命中大量会话正文,结果列表被内容匹配淹没,很难按名字找到目标会话。设置面板里对该功能的描述也是 "Search recent tasks by title or content"。
期望 / Expected behavior
提供一种仅匹配会话标题的搜索方式,任一形式均可:
- 搜索框内的作用域前缀或操作符,例如
title:重构或t:重构(现有的#/@/>前缀已用于区分 Tasks / Files / Actions,可在此基础上扩展); - 或搜索框旁的"仅标题"开关(类似编辑器的 "Match case" 切换);
- 或至少在结果排序上让标题命中排在内容命中之前。
为什么有用 / Motivation
- 会话数量增多后,按名字找会话是高频操作;全文搜索噪音太大,经常需要翻好几页。
- 现在 Command Center 的
#前缀只能限定范围,仍会搜正文;聊天输入框#弹出的会话选择器虽然只匹配标题,但仅限最近会话,无法覆盖全部历史。
实现建议(供参考) / Implementation hint
- 后端
queryTaskList的查询已同时访问title与searchable_text两列,增加一个matchTitleOnly查询参数并跳过第二个 LIKE 条件即可;UI 侧在 Command Center 的 scope parser 中加一个前缀(如title:)即可打通。 - 另外,CLI 侧的 RPC 目前只有
session/list(参数为 workspace / includeArchived / limit),若能加上search参数(或searchIn: "title" | "title+content"),桌面端和 CLI 用户都能受益。
环境 / Environment
- ZCode Desktop 3.11.2,Linux (Manjaro)
- 仓库反馈给 zai-org/feedback,针对 ZCode 桌面版
English summary: Session/task search currently matches title OR message content (LIKE on both columns), so common keywords flood the results with content matches. Please add a title-only match mode — e.g. a title: scope prefix in Command Center, or a "match title only" toggle. Backend hint: queryTaskList already queries both columns; a matchTitleOnly flag skipping the searchable_text LIKE would suffice. Optionally expose search/searchIn params on the session/list RPC.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the mentioned queryTaskList implementation, the Command Center scope parser, and the session/list RPC definition. Trace how search terms reach the title and searchable_text conditions, then define the selected title-only behavior and verify that it works through the relevant desktop or CLI search path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- sql
- Domain
- api, search
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100