Skip to content

fix: update Chinese filetype matching patterns#361

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

fix: update Chinese filetype matching patterns#361
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
Johnson-zs:master

Conversation

@Johnson-zs

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

Copy link
Copy Markdown
Contributor

Added "包" to the Chinese filetype matching pattern for applications to
improve search accuracy. The existing patterns ("安装包|软件|应用|脚本|
程序") were missing some common variations of application-related terms
in Chinese user queries.

Log: Improved Chinese application file type detection in search

Influence:

  1. Test search functionality with term "包" for application files
  2. Verify existing search patterns still work correctly
  3. Check if false positives are introduced for non-application files
  4. Ensure all application-related search terms return appropriate
    results

fix: 更新中文文件类型匹配模式

在中文应用程序文件类型的匹配模式中增加了"包"字,以提高搜索准确性。原有的
匹配模式("安装包|软件|应用|脚本|程序")缺少了对中文用户查询中应用程序相关
术语的某些常见变体。

Log: 改进了搜索中中文应用文件类型的检测

Influence:

  1. 使用"包"字测试应用程序文件的搜索功能
  2. 验证原有搜索模式是否仍然正常工作
  3. 检查是否会对非应用程序文件产生误判
  4. 确保所有应用程序相关的搜索词都能返回适当结果

Fixes: #370655

Summary by Sourcery

Enhancements:

  • Expand Chinese application file type matching patterns to include additional terms such as "包" for better detection of application files in search.

Added "包" to the Chinese filetype matching pattern for applications to
improve search accuracy. The existing patterns ("安装包|软件|应用|脚本|
程序") were missing some common variations of application-related terms
in Chinese user queries.

Log: Improved Chinese application file type detection in search

Influence:
1. Test search functionality with term "包" for application files
2. Verify existing search patterns still work correctly
3. Check if false positives are introduced for non-application files
4. Ensure all application-related search terms return appropriate
results

fix: 更新中文文件类型匹配模式

在中文应用程序文件类型的匹配模式中增加了"包"字,以提高搜索准确性。原有的
匹配模式("安装包|软件|应用|脚本|程序")缺少了对中文用户查询中应用程序相关
术语的某些常见变体。

Log: 改进了搜索中中文应用文件类型的检测

Influence:
1. 使用"包"字测试应用程序文件的搜索功能
2. 验证原有搜索模式是否仍然正常工作
3. 检查是否会对非应用程序文件产生误判
4. 确保所有应用程序相关的搜索词都能返回适当结果

Fixes: #370655
@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

@sourcery-ai

sourcery-ai Bot commented Jul 20, 2026

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

Reviewer's Guide

Updates the Chinese application filetype matching pattern to include an additional common term, improving semantic search detection for application-related files without altering other rules.

File-Level Changes

Change Details Files
Expanded the Chinese application filetype matching pattern to recognize queries containing the term "包" as application-related.
  • Updated the application-related filetype regex to append the "包" term to the existing alternation list
  • Ensured the updated pattern follows the same structure and ordering conventions as the existing Chinese filetype rules
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.

@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

★ 总体评分:100分

■ 【总体评价】

代码修改了文件类型识别的正则表达式规则,逻辑正确且符合规范
仅新增一个匹配词,无性能损耗与安全漏洞,评分满分

■ 【详细分析】

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

src/dfm-search/dfm-search-lib/semantic/rules/zh_CN/filetype_rules.json 文件的 filetype_application 规则中,正确地向 pattern 数组追加了 |包 选项,JSON 语法格式保持正确无误。
潜在问题:无
建议:无需修改

  • 2.代码质量(符合规范)✓

修改方式简洁明了,直接在原有正则表达式末尾增加匹配分支,符合现有的配置风格与缩进规范。
潜在问题:匹配词 较为宽泛,可能会导致非应用包类型的文件被误判为应用
建议:若 字容易引起误匹配,建议使用更精确的词汇或在描述中明确其匹配范围

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

正则表达式中增加一个简单的字符串分支匹配,对正则引擎的匹配效率影响微乎其微,不会引发性能瓶颈。
潜在问题:无
建议:无需修改

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

漏洞对比统计:新增漏洞 0 个,减少漏洞 0 个,持平 0 个
本次修改为 JSON 配置文件中的正则字符串调整,不涉及任何外部输入解析、命令执行或内存操作,不存在安全风险。

  • 建议:无需安全修复

■ 【改进建议代码示例】

{
    "id": "filetype_application",
    "pattern": "安装包|软件|应用|脚本|程序|包",
    "description": "Application packages",
    "enabled": true,
    "priority": 150
}

@Johnson-zs

Copy link
Copy Markdown
Contributor Author

/forcemerge

@deepin-bot

deepin-bot Bot commented Jul 20, 2026

Copy link
Copy Markdown

This pr force merged! (status: blocked)

@deepin-bot
deepin-bot Bot merged commit fbc919d into linuxdeepin:master Jul 20, 2026
22 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