-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
[Type] Enhancement : post higher priority in link search results #63836
base: trunk
Are you sure you want to change the base?
Conversation
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 Unlinked AccountsThe following contributors have not linked their GitHub and WordPress.org accounts: @coenve. Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases. 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. |
👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @kartikmehta8! In case you missed it, we'd love to have you join us in our Slack community. If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information. |
I think @noisysocks worked on this recently, so might have some thoughts. Hope you don't mind that I added you as a reviewer, Rob! |
Hey thanks for the PR! I haven't tested it but I suspect this approach will cause a regression of #56478 if there are more than 20 posts or pages on the site containing the search term. This is because all twenty of those posts and pages will receive a score of We want to prioritise posts and pages but not so much that they crowd out attachments, tags, and categories that are very relevant to the search query. How did you arrive at 1 as a base score for posts and pages? I expect the solution will be to change this to 0.5 or thereabouts. The exact number will need to be dialled in from testing with real data. The testing steps in #62397 describe how you can set yourself up with testing data that is good for working on this feature. |
Ever since Wordpress added the score element to the link suggestions, my editors have been complaining about tags and attachments coming up first instead of relevant blogs they would like to link to. They find it very annoying that the sort order was changed. They asked me if I could undo that change. Since I don't want to mess around in the source code, is there a filter I can use to manually override the search order? My opinion on this case is: We run a technology blog with tens of thousands of blogs. For example we write a lot about Microsoft, we have a few dozen Microsoft tags. If an author now wants to link to a recent Microsoft blog it's hard, because there are too many tags that start with Microsoft. |
What?
This PR updates the
sortResults
function in the link suggestions feature to prioritize pages and posts above attachments in search results.Why?
Attachments were being surfaced higher in search results than posts matching the search requirements. This change ensures that pages and posts are prioritized in the search results, which is more likely to be the desired outcome for users.
How?
The
sortResults
function has been updated to add a score increment for results that are ofkind
post-type
andtype
post
orpage
. This adjustment ensures that these types of results are prioritized above others, such as attachments.Testing Instructions
Testing Instructions for Keyboard
Issue
Screenshots or screencast
N/A