Skip to content

feat: update file type matching patterns - #363

Merged
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
Johnson-zs:master
Jul 21, 2026
Merged

feat: update file type matching patterns#363
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
Johnson-zs:master

Conversation

@Johnson-zs

@Johnson-zs Johnson-zs commented Jul 21, 2026

Copy link
Copy Markdown
Contributor
  1. Removed specific file extensions (zip/rar/psd/fig/sketch) from
    Chinese file type matching rules
  2. Kept only the generic Chinese descriptions for archive and design
    source files
  3. This makes the matching more language consistent and prevents
    potential overlap with extension-based matching systems

Influence:

  1. Test Chinese file search functionality to ensure it still matches the
    intended file types
  2. Verify that generic Chinese terms still properly identify archive and
    design source files
  3. Check for any regression in file type classification accuracy

feat: 更新文件类型匹配模式

  1. 从中文文件类型匹配规则中移除了特定文件扩展名(zip/rar/psd/fig/sketch)
  2. 只保留了归档文件和设计源文件的通用中文描述
  3. 这使得匹配更加语言一致,并防止与基于扩展名的匹配系统潜在冲突

Influence:

  1. 测试中文文件搜索功能,确保仍能匹配目标文件类型
  2. 验证通用的中文术语仍能正确识别归档文件和设计源文件
  3. 检查文件类型分类准确性是否出现回归

Fixes: #370661

Summary by Sourcery

Enhancements:

  • Relax file type patterns in zh_CN rules by removing explicit extensions such as zip/rar/psd/fig/sketch and keeping generic Chinese descriptions for archives and design sources.

1. Removed specific file extensions (zip/rar/psd/fig/sketch) from
Chinese file type matching rules
2. Kept only the generic Chinese descriptions for archive and design
source files
3. This makes the matching more language consistent and prevents
potential overlap with extension-based matching systems

Influence:
1. Test Chinese file search functionality to ensure it still matches the
intended file types
2. Verify that generic Chinese terms still properly identify archive and
design source files
3. Check for any regression in file type classification accuracy

feat: 更新文件类型匹配模式

1. 从中文文件类型匹配规则中移除了特定文件扩展名(zip/rar/psd/fig/sketch)
2. 只保留了归档文件和设计源文件的通用中文描述
3. 这使得匹配更加语言一致,并防止与基于扩展名的匹配系统潜在冲突

Influence:
1. 测试中文文件搜索功能,确保仍能匹配目标文件类型
2. 验证通用的中文术语仍能正确识别归档文件和设计源文件
3. 检查文件类型分类准确性是否出现回归

Fixes: #370661
@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Johnson-zs

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

★ 总体评分:100分

■ 【总体评价】

代码优化了中文语义搜索规则配置,移除了冗余的英文扩展名匹配项
逻辑正确且提升了规则匹配的精准度,无任何安全风险

■ 【详细分析】

  • 1.语法逻辑(完全正确)✓

修改后的 JSON 格式合法,正则表达式模式字符串符合规范,文件路径为 src/dfm-search/dfm-search-lib/semantic/rules/zh_CN/filetype_rules.json
潜在问题:无
建议:无需修改

  • 2.代码质量(优秀)✓

将中文语义规则与英文扩展名匹配逻辑分离,去除了 filetype_archive 中的 zip|rar 和 filetype_design_source 中的 psd|fig|sketch,避免了职责混淆
潜在问题:无
建议:维持当前修改

  • 3.代码性能(无性能问题)✓

缩短了正则表达式的长度,减少了匹配分支,有助于提升语义搜索的解析速度
潜在问题:无
建议:无需修改

  • 4.代码安全(存在0个安全漏洞)✓

漏洞对比统计:新增漏洞 0 个,减少漏洞 0 个,持平 0 个
配置文件仅涉及字符串模式调整,不存在外部输入处理或命令执行,无安全风险
建议:无需修改

■ 【改进建议代码示例】

--- a/src/dfm-search/dfm-search-lib/semantic/rules/zh_CN/filetype_rules.json
+++ b/src/dfm-search/dfm-search-lib/semantic/rules/zh_CN/filetype_rules.json
@@ -118,7 +118,7 @@
                 },
                 {
                     "id": "filetype_archive",
-                    "pattern": "压缩包|归档|源码包|打包文件|zip|rar",
+                    "pattern": "压缩包|归档|源码包|打包文件",
                     "description": "Archive files",
                     "enabled": true,
                     "priority": 150,
@@ -140,7 +140,7 @@
                 },
                 {
                     "id": "filetype_design_source",
-                    "pattern": "源文件|设计稿|矢量图|工程文件|psd|fig|sketch",
+                    "pattern": "源文件|设计稿|矢量图|工程文件",
                     "description": "Design source files",
                     "enabled": true,
                     "priority": 160,

@sourcery-ai

sourcery-ai Bot commented Jul 21, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This PR updates the Chinese (zh_CN) semantic file type matching rules to rely on generic language-based descriptions for archive and design source files instead of hard-coded extension-specific entries, reducing overlap with extension-based classifiers.

File-Level Changes

Change Details Files
Relax and simplify zh_CN semantic file type rules by removing hard-coded extension-specific patterns and keeping only generic language-based descriptions for archives and design sources.
  • Deleted rule entries that explicitly referenced zip, rar, psd, fig, and sketch file extensions in the Chinese file type matching configuration.
  • Retained and possibly emphasized generic Chinese semantic phrases for archive files (e.g., compressed/packaged/archived) and design source files (e.g., design draft/source) to drive matching.
  • Aligned semantic rules to avoid redundancy or conflict with separate extension-based matching systems by ensuring the JSON only encodes language semantics, not extensions.
src/dfm-search/dfm-search-lib/semantic/rules/zh_CN/filetype_rules.json

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@Johnson-zs

Copy link
Copy Markdown
Contributor Author

/forcemerge

@deepin-bot

deepin-bot Bot commented Jul 21, 2026

Copy link
Copy Markdown

This pr force merged! (status: blocked)

@deepin-bot
deepin-bot Bot merged commit 792dca0 into linuxdeepin:master Jul 21, 2026
18 of 23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants