fix(github): exclude issue source metadata

This commit is contained in:
t8y2
2026-07-21 21:39:01 +08:00
parent 9118240cd4
commit ad573b232c
2 changed files with 20 additions and 0 deletions
@@ -9,6 +9,8 @@ const MAX_CANDIDATES = 3;
const SEARCH_RESULT_LIMIT = 20;
const ignoredSectionPatterns = [
/^来源$/i,
/^source$/i,
/数据库类型/i,
/database type/i,
/支持信息/i,
@@ -8,6 +8,7 @@ import {
rankCandidates,
run,
scoreCandidate,
searchTerms,
searchTitleTerms,
} from "./suggest-similar-issues.mjs";
@@ -52,6 +53,23 @@ test("builds a short title query with identifiers split safely", () => {
assert.doesNotMatch(query, /失效|弹出/u);
});
test("excludes bot source metadata from searchable text", () => {
const issue = {
...baseIssue,
body: `### 来源
QQ 群反馈 · **反馈人**:独特反馈人名称
### 原始描述
查询结果无法保存。`,
};
const terms = searchTerms(issue);
assert.doesNotMatch(terms, /QQ群反馈|独特反馈人名称/u);
assert.match(terms, /查询结果无法保存/u);
});
test("keeps compound Chinese product terms in the title query", () => {
const query = searchTitleTerms({ title: "[Feature] 增加多列选中转置功能、增加转置列注释" });
assert.match(query, /多列/u);