-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Enable remote search in Themes if custom themes are supported #24262
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
Enable remote search in Themes if custom themes are supported #24262
Conversation
…wift - Apply immediate local search when search text changes - Perform remote search for WordPress.com themes with 3+ characters - Update predicates to include local search conditions for custom themes - Refactor comments for clarity on search behavior and conditions
- Modify `ThemeBrowserViewController.swift` to include `resetRemoteSearch` method - Integrate `resetRemoteSearch` in search logic to reset search state upon search text changes - Adjust logic to handle shorter search queries that follow longer ones by resetting remote search - Ensure local results reload consistently after search operations
- Update test to use nil instead of empty string for search in ThemeServiceTests.m
- Change `fileprivate` to `private` for several functions and variables in ThemeBrowserViewController.swift - Simplify guard statement in `updateSearchName` function - Update comment in `customThemesBrowsePredicate` function
|
App Name | ![]() |
|
Configuration | Release-Alpha | |
Build Number | pr24262-69c5b90 | |
Version | 25.8 | |
Bundle ID | org.wordpress.alpha | |
Commit | 69c5b90 | |
App Center Build | WPiOS - One-Offs #11757 |
|
App Name | ![]() |
|
Configuration | Release-Alpha | |
Build Number | pr24262-69c5b90 | |
Version | 25.8 | |
Bundle ID | com.jetpack.alpha | |
Commit | 69c5b90 | |
App Center Build | jetpack-installable-builds #10783 |
Hey, thanks for addressing it! I tested the steps from the reported issue, and was able to find the theme: Simulator.Screen.Recording.-.iPhone.16.Pro.-.2025-03-20.at.09.29.39.mp4
Can we eliminate local search? What are the scenarios under which remote searching was not available? We were in a similar situation with the search for your posts that was local and broken in the same way. It now searches exclusively using the search endpoint – no local results are ever shown. I've noticed some minor glitches when searching. It would initially show "No matching results" but then, presumably when the app gets the response, it would show the results. Eliminating local search (for anything other than custom theme?) should address it.
Does the endpoint support searching with fewer characters? I'd expect to be able to type a single character and return some results that start with it. |
Modules/Package.swift
Outdated
@@ -46,7 +46,7 @@ let package = Package( | |||
.package(url: "https://github.com/wordpress-mobile/MediaEditor-iOS", branch: "task/spm-support"), | |||
.package(url: "https://github.com/wordpress-mobile/NSObject-SafeExpectations", from: "0.0.6"), | |||
.package(url: "https://github.com/wordpress-mobile/NSURL-IDN", branch: "trunk"), | |||
.package(url: "https://github.com/wordpress-mobile/WordPressKit-iOS", branch: "wpios-edition"), | |||
.package(url: "https://github.com/wordpress-mobile/WordPressKit-iOS", branch: "add-search-param-in-theme-service-remote"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make sure to update it to point to wpios-edition
before merging.
Thanks for testing it @kean!
The scenarios where remote searching is not available are:
So, I think it's important to maintain local search for two reasons. First, while the user is searching remotely, we also display and search locally among the user's installed themes. Plus, if a user is on WP.com free plans, we should allow them to search among available themes, which currently number 170+ (around 4 pages of pagination).
I was not able to replicate this issue, even when typing slowly. Keep in mind that remote searching uses its own logic and is not perfect in my experiments. For example, I tried searching for the final part of a text and the theme was not found, while typing the initials of the theme did yield results.
Unfortunately, no, but it's not documented anywhere, and indeed this case is handled. If we send the search with fewer than 3 characters to the API request, it always returns 0 results, which is far from ideal. Maybe this can be improved on the UX side by explicitly asking users to add at least 3 characters. |
…153-cannot-search-for-themes-if-not-already-downloaded # Conflicts: # WordPress.xcworkspace/xcshareddata/swiftpm/Package.resolved
|
App Name | Jetpack | |
Configuration | Release-Alpha | |
Build Number | 26920 | |
Version | PR #24262 | |
Bundle ID | com.jetpack.alpha | |
Commit | 1d552f7 | |
Installation URL | 1fc6to2gbp5e8 |
|
App Name | WordPress | |
Configuration | Release-Alpha | |
Build Number | 26920 | |
Version | PR #24262 | |
Bundle ID | org.wordpress.alpha | |
Commit | 1d552f7 | |
Installation URL | 5pot4107tb69o |
@kean I requested a new review since now the PR is pointing to the right branch of WordPressKit |
|
||
// For regular themes, add local search predicate if: | ||
// 1. Not using custom themes feature, or | ||
// 2. Search term is less than 3 characters (we'll only search locally for short terms) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just noting that it's an unfortunate limitation.
Fixes #23153
Dependent on this PR wordpress-mobile/WordPressKit-iOS#834
This PR partially improves the search functionality within the Theme by enhancing its capabilities. Previously, the search was limited to locally fetched themes and did not include elements that had not been paginated. Now, it works remotely for blogs that support custom themes. The endpoint used for this case supports search, whereas other endpoints, such as the one utilized by the
getThemesForBlogId
method, do not support remote search functionality.However, the search is available for
getWPThemesPage
(which calls thev2.0/themes
endpoint) only if at least 3 characters are added in the search bar. For this reason, this limitation has also been handled in the app. For all other endpoints where remote searching is not available, the search continues to work locally.Keep in mind during your tests that searching through the API does not only look for matches in the title of the theme. Therefore, when you type a string, you may see other related themes as well.
To test:
Custom Themes not supported
Custom Themes supported
scrawl
.Regression Notes
Potential unintended areas of impact
What I did to test those areas of impact (or what existing automated tests I relied on)
What automated tests I added (or what prevented me from doing so)
PR submission checklist:
RELEASE-NOTES.txt
if necessary.Testing checklist: