search: FTS special characters are deleted, not separated, so leaf(entry) matches nothing
维护者通常 1 天内回复
评估
- 难度
- 1/5
- 预计耗时
- 1 小时以内
- 新手友好度
- 88/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- typescript
- 领域
- search
调研方向
从 src/db/queries.ts 第 2036 行附近开始,那里的 FTS5 特殊字符 replace 会构造搜索词。先用 codegraph query "leaf(entry)" 在示例文件上复现,确认结果为空。把替换内容改为空格,使两边各自成为带引号的独立词项,然后重新运行 leaf(entry)、leaf^entry、leaf() 以及普通的 leaf entry 查询,确认没有回归。完成的标准是:调用表达式查询能返回具名符号,且现有的搜索测试全部通过。
由索引模型根据 Issue 内容生成。
描述
Full-text search deletes FTS5 special characters instead of turning them into separators, so identifiers on either side of a (, ), ^, :, ", ' or * merge into one token that matches nothing.
// a.ts
export function entry() { mid1(); mid2(); }
export function leaf() { return 1; }
| query | result on main |
|---|---|
codegraph query "leaf entry" |
entry, leaf ✓ |
codegraph query "leaf(entry)" |
No results found |
codegraph query "leaf()" |
leaf ✓ (nothing follows the paren) |
The same happens through the library (searchNodes('leaf(entry)'), 'leaf^entry', 'leaf"entry' all return []). The LIKE and fuzzy fallbacks don't recover it.
Cause. db/queries.ts#L2036: .replace(/['"*():^]/g, '') // Remove FTS5 special chars turns leaf(entry) into the single term "leafentry"*.
Reproduced on main at 7973df0d with CODEGRAPH_KERNEL=0. Linux/WSL2, Node 22.23.2.
Why it matters. Agents and people paste call expressions and signatures into search (render(props), getUser(id), Foo::bar(x)), and those come back empty instead of finding the named symbols.
Fix. Replace with a space instead of the empty string (.replace(/['"*():^]/g, ' ')). Each side then becomes its own quoted term.
- 主要语言
- C
- 星标
- 73.2k
- 派生
- 4.7k
- 平均合并
- 3 小时 13 分钟
- 30 天内合并 PR
- 579
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
colbymchenry/codegraph 的其他 Issue
-
mcp: a projectPath naming a file inside a project returns isError ("Path is not a directory")可能已有人在做 @maxmilian 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 76/100
colbymchenry/codegraph#2982 ·
维护者通常 1 天内回复
-
mcp: a non-object tools/call arguments crashes the handler and is reported as an internal error to retry可能已有人在做 @kjgggggg 于 1 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 82/100
colbymchenry/codegraph#2981 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
colbymchenry/codegraph#2974 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 66/100
colbymchenry/codegraph#2959 · 1 条评论 ·
维护者通常 1 天内回复
-
TypeScript: an import resolves to a same-named method of an exported object literal instead of the exported function可能已有人在做 @inth3shadows 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 75/100
colbymchenry/codegraph#2945 ·
维护者通常 1 天内回复
查看 colbymchenry/codegraph 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 66/100
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
zephyrproject-rtos/zephyr#123881 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 77/100
eclipse-zenoh/zenoh-pico#1354 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 65/100
ly05010419/MacNativeGames#1252 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
维护者通常 2 天内回复