Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

search: FTS special characters are deleted, not separated, so leaf(entry) matches nothing

未关闭 适合新手
#2,971 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@kjgggggg 已经在做这个了。

开始于 2026年10月28日。

  • #2987 来自 @kjgggggg —— 未关闭

评估

难度
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,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

colbymchenry/codegraph 的其他 Issue

查看 colbymchenry/codegraph 的全部 Issue

相似的 Issue

更多 C Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。