Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore accents when doing a bookmark search #3255

Merged
merged 3 commits into from
Sep 12, 2024

Conversation

jotaemepereira
Copy link
Collaborator

@jotaemepereira jotaemepereira commented Sep 11, 2024

Task/Issue URL: https://app.asana.com/0/1203972458584429/1208262956542583/f
Tech Design URL:
CC:

Description

Acceptance criteria
AC#1
Given a user with a bookmark with an accent, for example café , when searching for cafe we should return the bookmark with the accent.

AC#2
Given a user with a bookmark without an accent, for example cafe , when searching for café we should return the bookmark without the accent, ignoring the accent on the search query.

AC#3
Given a user with a bookmark with symbols, for example, Site • Login , when searching for site login then we should return the bookmark with the symbol

AC#4
Given a user with a bookmark without symbols, for example, Site Login , when searching for site • login then we should return the bookmark without the symbol ignoring the symbol in the search query.

Steps to test this PR

Accents

  1. Add a bookmark, and in the bookmark name, add it with an accent. For example, café
  2. Go to the bookmarks manager or the bookmark panel and start a search
  3. Search for cafe (without the accent)
  4. It should return the result
  5. Do the same thing but viceversa. Create a bookmark without an accent, for example, cafe, and search for café, the accent should be ignored and the result should be returned in the search.

Symbols

  1. Add a bookmark, and in the bookmark name, add it with a symbol. For example, Site • Login
  2. Go to the bookmarks manager or the bookmark panel and start a search
  3. Search for site login (without the symbol)
  4. It should return the result
  5. Do the same thing but viceversa.

Definition of Done:

Internal references:

Pull Request Review Checklist
Software Engineering Expectations
Technical Design Template
Pull Request Documentation

@jotaemepereira jotaemepereira requested review from a team and federicocappelli and removed request for a team September 11, 2024 17:23
Copy link
Member

@federicocappelli federicocappelli left a comment

Choose a reason for hiding this comment

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

A few comments, mostly around naming, documentation and unit tests @mainactor use

@@ -85,6 +85,24 @@ extension String {
self.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty
}

var cleanStringForBookmarkSearch: String {
Copy link
Member

Choose a reason for hiding this comment

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

Very picky notes:

  1. In general, functions that get self and return a modified version of self are named like replacingOccurrences(of:...), this could be replacing.... or cleaning...
  2. This is a function in a shared framework but is very specific and undocumented, I see 2 options here:
    a. Use a more generic name and add documentation explaining the input, the expected output, the use cases and examples.
    b. Leave it as it is but move it from the shared extension to a private, bookmarks only, extension

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I will move the extension to where is used and make it private. This is not going to be used elsewhere so it makes sense to remove it from here 👍🏼 .

About the name, I’m renaming it to: cleaningStringForBookmarkSearch. I will also add some documentation to it.

.lowercased()
}

private func removeAccents() -> String {
Copy link
Member

Choose a reason for hiding this comment

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

Same as above, very generic name and no documentation.
The above naming convention comment is valid for this too.

Copy link
Collaborator Author

@jotaemepereira jotaemepereira Sep 12, 2024

Choose a reason for hiding this comment

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

@federicocappelli What’s generic about the name 🤔 ? Removing accents seems clear to me, the function removes any accent from the string. What other naming suggestions do you have in mind?

I will add some documentation so it’s clearer.

Copy link
Member

Choose a reason for hiding this comment

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

sorry, with generic name I meant that it doesn't follow the usual naming convention replacing.... or cleaning... etc

Copy link
Member

@federicocappelli federicocappelli left a comment

Choose a reason for hiding this comment

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

LGTM

@jotaemepereira jotaemepereira merged commit 439f6fe into main Sep 12, 2024
21 checks passed
@jotaemepereira jotaemepereira deleted the juan/ignore-accents-when-searching-bookmarks branch September 12, 2024 12:41
samsymons added a commit that referenced this pull request Sep 12, 2024
# By Dominik Kapusta (4) and others
# Via Dominik Kapusta (4) and GitHub (2)
* main:
  Support dragging strings to new tab button (#3228)
  BSK - Add feature flag for SKAN API (#3265)
  Ignore accents when doing a bookmark search (#3255)
  Update UI tests workflows to always compile the app on the supported version of Xcode (#3262)
  Bump C.S.S (via BSK) (#3244)
  Tab previews presentation implementation adjusted for the latest MouseOverView logic (#3260)
  Bump version to 1.106.0 (260)
  Default to appstore signing for fastlane match
  Clean up secrets in GHA workflows
  Update Onboarding gradients (#3248)
  Wait for UserScripts to be loaded for email protection (#3252)
  Fix UI tests failing in the CI (#3254)
  Fix WKDownloadMock mock (#3258)
  VPN Proxy stop and pixel improvements (#3239)
  Use fastlane match for code signing DMG builds (#3246)
  Implement new VPN site troubleshooting report alert (#3224)

# Conflicts:
#	DuckDuckGo.xcodeproj/project.pbxproj
#	DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
samsymons added a commit that referenced this pull request Sep 13, 2024
# By Dominik Kapusta (7) and others
# Via Dominik Kapusta (6) and GitHub (4)
* main: (37 commits)
  Add visted links support (#3261)
  Bump version to 1.106.0 (261)
  Update Gemfile.lock
  Remove migration file (#3270)
  Use new AsanaCreateActionItem action (#3264)
  Update survey builder OS version (#3247)
  Support dragging strings to new tab button (#3228)
  BSK - Add feature flag for SKAN API (#3265)
  Ignore accents when doing a bookmark search (#3255)
  Update UI tests workflows to always compile the app on the supported version of Xcode (#3262)
  Bump C.S.S (via BSK) (#3244)
  Tab previews presentation implementation adjusted for the latest MouseOverView logic (#3260)
  Bump version to 1.106.0 (260)
  Default to appstore signing for fastlane match
  Clean up secrets in GHA workflows
  Update Onboarding gradients (#3248)
  Wait for UserScripts to be loaded for email protection (#3252)
  Fix UI tests failing in the CI (#3254)
  Fix WKDownloadMock mock (#3258)
  VPN Proxy stop and pixel improvements (#3239)
  ...

# Conflicts:
#	DuckDuckGo.xcodeproj/project.pbxproj
#	DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
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