-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Use relevance pattern matching for parent page search #73836
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
Use relevance pattern matching for parent page search #73836
Conversation
When users search for keywords in the parent page selector, perform exact pattern matching rather than partial/fuzzy matching. This provides more precise search results and better matches user expectations when searching for specific page titles. - Add `exact: true` parameter to search query in parent-edit.tsx - Add `exact: true` parameter to search query in parent.js
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Size Change: +25 B (0%) Total Size: 2.57 MB
ℹ️ View Unchanged
|
Changed the search behavior in the parent page selector to prioritize relevance over exact matches. This adjustment enhances the search experience by providing more relevant results based on user input. - Updated search query in parent-edit.tsx and parent.js to use `orderby: 'relevance'` instead of `exact: true`.
Mamaduka
left a comment
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.
Works as expected. Thank you, @ramonjd!
|
Nice, thanks for the fix 🚀 |
What
This PR updates the parent page search functionality to use relevance-based matching when users search for keywords. When a search term is entered, results are now ordered by relevance (how well they match the search term) rather than by menu order, providing more intuitive and useful search results.
Why
Previously, the search used partial/fuzzy matching, which could return results that didn't match the user's intent.
This was especially obvious for sites with large page counts. See: Automattic/wp-calypso#49684
How
orderby: 'relevance'to the search query whenfieldValueis not nullorderby: 'relevance'to the search query whenfieldValueis truthyBoth implementations now use relevance-based ordering when a search term is provided, ensuring that the WordPress REST API returns results sorted by how well they match the search query, with the most relevant matches appearing first.
Testing Instructions
Prerequisites
Test Steps
OR create a bunch using wp-cli:
Test relevance-based ordering in Post Editor:
Test relevance-based ordering in Dataviews/Fields:
Test ordering behavior:
menu_order(default behavior)relevanceorderingVerify no regression:
getItemPriorityfunction still works correctly for client-side sorting of results