Core Data: Surface and prioritize matched results in fetchLinkSuggestions#78733
Core Data: Surface and prioritize matched results in fetchLinkSuggestions#78733sarthaknagoshe2002 wants to merge 1 commit into
Conversation
|
Warning: Type of PR label mismatch To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.
Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task. |
|
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. |
What?
Closes #76805
This PR introduces a parallel slug-based lookup to
__experimentalFetchLinkSuggestionswhen a user searches for content. It bypasses the limitation where the core/wp/v2/searchendpoint strictly screens text matches against titles and excerpts, entirely leaving out valid matches containing different URL slugs.Why?
When managing slugs & special character routing (e.g., changing a slug from
kursuebersichttokursewhile maintaining the presentation title asKursübersicht), users inevitably search for pages by their URL paths/slugs inside the Link UI popover.Because
/wp/v2/searchcompletely disregards slug criteria, it yields empty payloads for those keywords. There are zero client-side results available to filter or sort.How?
/wp/v2/postsor/wp/v2/pages) via theslug=argument, extract hidden records & deduplicate them against title matches.sortResultscalculator by parsing slugs with a cleanextractSlughelper and assigning a specialized exact slug scale coefficient (8). This slots slug matching elegantly right beneath an exact title match (10) but completely above fuzzy or string-token fraction overlaps (<1).Scenario Setup
Create three separate pages in your WordPress dashboard with distinct titles and slugs to test both exact slug matches and fuzzy title matches:
Testing Instructions
kurseinto the search field.Kursübersichtmust be successfully pulled into the results list via the new parallel slug lookup path and float to the absolute top of the list due to its exact slug score modifier. It should be followed secondarily by content match (Contact Us), proving that the exact slug match successfully outranks standard fuzzy content matches.Screenshots or screencast