Skip to content

Revert "feat: Add fuzzy search support for applications"#560

Merged
BLumia merged 1 commit into
linuxdeepin:masterfrom
wjyrich:revert-fuzzysearch
May 14, 2025
Merged

Revert "feat: Add fuzzy search support for applications"#560
BLumia merged 1 commit into
linuxdeepin:masterfrom
wjyrich:revert-fuzzysearch

Conversation

@wjyrich
Copy link
Copy Markdown
Contributor

@wjyrich wjyrich commented May 14, 2025

This reverts commit 8e2bca7.

Summary by Sourcery

Revert fuzzy search support and simplify search filter logic to use direct substring matching across multiple name representations.

Enhancements:

  • Simplify filterAcceptsRow to use direct substring checks on displayName, normalized name, transliterated text, and initial letters.
  • Add jianpin matching via Dtk::Core::firstLetters.

Chores:

  • Remove fuzzyMatch method and fuzzy threshold configuration.

@deepin-ci-robot
Copy link
Copy Markdown

deepin pr auto review

关键摘要:

  • 删除了fuzzyMatch函数,改用contains方法进行模糊匹配,简化了代码逻辑。
  • 新增了jianpin变量,用于存储简拼,但未提供Dtk::Core::firstLetters函数的实现细节,可能需要确认其正确性和性能影响。
  • nameCopy变量用于处理name字符串,但直接使用name的副本可能会导致不必要的内存分配,建议使用QStringtoLower()replace()方法直接修改原字符串。

是否建议立即修改:

  • 是,需要确认Dtk::Core::firstLetters函数的实现和性能,并考虑优化nameCopy的处理方式。

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

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

Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

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.

const QString & displayName = modelIndex.data(Qt::DisplayRole).toString();
const QString & name = modelIndex.data(AppsModel::NameRole).toString();
const QString & transliterated = modelIndex.data(AppsModel::AllTransliteratedRole).toString();
const QString & jianpin = Dtk::Core::firstLetters(displayName).join(',');
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

suggestion (bug_risk): Using join(',') inserts commas between initials and may break substring matching

Use join("") instead of join(",") to concatenate initials without commas so contains() works as expected.

Suggested change
const QString & jianpin = Dtk::Core::firstLetters(displayName).join(',');
// concatenate initials without commas so contains() works correctly
const QString jianpin = Dtk::Core::firstLetters(displayName).join(QString());

@deepin-ci-robot
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: BLumia, wjyrich

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

@BLumia BLumia merged commit 91647b5 into linuxdeepin:master May 14, 2025
6 checks passed
@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented May 14, 2025

Reviewer's Guide

This PR reverts the previously added fuzzy search feature by removing the fuzzyMatch implementation and simplifying the row filtering logic to use basic substring checks and jianpin matching.

File-Level Changes

Change Details Files
Remove fuzzy search implementation
  • Deleted the fuzzyMatch method’s definition and logic
  • Removed the m_fuzzyThreshold member variable declaration
src/models/searchfilterproxymodel.cpp
src/models/searchfilterproxymodel.h
Simplify filterAcceptsRow to use basic contains and jianpin
  • Replaced searchPattern normalization and fuzzyMatch calls with nameCopy.toLower().replace
  • Added jianpin extraction via Dtk::Core::firstLetters for matching
  • Updated return condition to use .contains on displayName, nameCopy, transliterated, and jianpin
src/models/searchfilterproxymodel.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

@wjyrich wjyrich deleted the revert-fuzzysearch branch June 6, 2025 00:36
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.

3 participants