Skip to content

fix: search applications by GenericName and Keywords (linuxdeepin/developer-center#3375) - #829

Open
foresee-io wants to merge 1 commit into
linuxdeepin:masterfrom
foresee-io:master
Open

foresee-io wants to merge 1 commit into
linuxdeepin:masterfrom
foresee-io:master

Conversation

@foresee-io

@foresee-io foresee-io commented Oct 21, 2026 •

Copy link
Copy Markdown

Related to linuxdeepin/developer-center#3375.

The launcher cannot currently find applications using their Desktop Entry Keywords, and GenericName is not consistently included in search.

This PR extends the existing search filter to match GenericName and Keywords from the shared application model, including exact, prefix and substring matches. It retains the existing name-matching behavior and gives keyword matches lower priority than name-based matches.

Regression tests cover the new search fields and locale-selected keywords.

Depends on the corresponding dde-shell and dde-application-manager changes.


启动器目前无法通过 Desktop Entry 的 Keywords 查找应用,对 GenericName 的检索支持也不完整。

本 PR 扩展现有搜索过滤器,支持对共享应用模型中的 GenericName 和 Keywords 进行精确、前缀及子串匹配。保留原有名称检索行为,并将关键词匹配排在名称类匹配之后。

同时补充新字段及本地化关键词的检索回归测试。

依赖对应的 dde-shell 和 dde-application-manager 修改。

Summary by Sourcery

Extend launcher application search to include GenericName and Keywords while preserving existing name-match ranking.

New Features:

  • Enable application search through Desktop Entry GenericName and localized Keywords with exact, prefix, and substring matching.

Bug Fixes:

  • Fix incomplete launcher search coverage for GenericName and previously unsupported Keywords.

Enhancements:

  • Expose Keywords through AppsModel and prioritize keyword matches below name-based matches.

Tests:

  • Add regression coverage for GenericName, Keywords, and localized keyword search results.

1. Forward the shared application model's Keywords role and its updates.
2. Match the existing scalar GenericName and selected Keywords without
   reading desktop files or collecting additional locale variants.
3. Add search regression coverage for generic names, keywords and
   unrelated locale values.

Log: Find applications by their generic names and desktop entry keywords
Influence: GenericName participates in search for all vendors; existing
          name matching and search ranking priorities are retained.

feat: 支持通过 GenericName 和 Keywords 搜索应用

1. 转发共享应用模型的 Keywords 角色及其更新通知。
2. 直接匹配既有单数 GenericName 和选中的 Keywords,不另行读取桌面文件,
   也不收集其他 locale 的值。
3. 补充通用名称、关键词及无关 locale 值的搜索回归测试。

Log: 支持通过通用名称和桌面文件关键词查找应用
Influence: GenericName 参与所有厂商应用的搜索;保留既有名称匹配逻辑及
          原有匹配规则的相对排序优先级。
Copilot AI balanced review requested due to automatic review settings October 21, 2026 09:33

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: foresee-io

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

@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@deepin-ci-robot

Copy link
Copy Markdown

Hi @foresee-io. Thanks for your PR. 😃

@deepin-ci-robot

Copy link
Copy Markdown

Hi @foresee-io. Thanks for your PR.

I'm waiting for a linuxdeepin member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@sourcery-ai

sourcery-ai Bot commented Oct 21, 2026

Copy link
Copy Markdown

Reviewer's Guide

The PR forwards localized Desktop Entry Keywords through the shared AppsModel and incorporates both GenericName and Keywords into the existing weighted search filter, with name matches retaining priority and regression tests covering the new fields.

Sequence diagram for application search with GenericName and Keywords

sequenceDiagram
    participant Search as SearchFilterProxyModel
    participant Apps as AppsModel
    participant Shared as SharedApplicationModel

    Search->>Apps: data(AppsModel::GenericNameRole)
    Apps->>Shared: sourceData(GenericNameRoleName)
    Shared-->>Apps: GenericName
    Search->>Apps: data(AppsModel::KeywordsRole)
    Apps->>Shared: sourceData(KeywordsRoleName)
    Shared-->>Apps: localized Keywords
    Search->>Search: calculateWeight(modelIndex)
    Search-->>Search: name matches prioritized over GenericName and Keywords
Loading

Flow diagram for weighted application search matching

flowchart TD
    Input[Search pattern] --> Name[Name matching]
    Name --> Generic[GenericName matching]
    Generic --> Transliteration[Transliterated and jianpin matching]
    Transliteration --> Keywords[Keywords matching]
    Keywords --> Weight[calculateWeight]
    Weight --> Results[Ranked applications]
Loading

File-Level Changes

Change Details Files
Expose the shared model’s localized Keywords field through AppsModel so consumers can search it without reading desktop files directly.
  • Added a Keywords role and role-name mapping.
  • Forwarded keyword data and change notifications from the source model.
src/models/appsmodel.h
src/models/appsmodel.cpp
Extend search weighting to include GenericName and Keywords while preserving existing name matching precedence.
  • Added exact and substring GenericName matching plus word-prefix matching.
  • Added exact, word-prefix, and substring keyword matching at lower priority than name-based matches.
  • Normalized case and whitespace and ignored duplicate or empty keyword values.
src/models/searchfilterproxymodel.cpp
Add regression coverage for shared-field exposure and localized GenericName/Keywords searches.
  • Added Keywords test-role data and fixture support.
  • Verified GenericName exact, prefix/substring, and localized keyword searches alongside unchanged name behavior.
tests/searchfilterproxymodeltest.cpp

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 ✨

@foresee-io

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants