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

Term sorting is incorrect in flat term selector #47795

Merged
merged 3 commits into from
Feb 8, 2023

Conversation

mauteri
Copy link
Contributor

@mauteri mauteri commented Feb 6, 2023

What?

The current search for term selection component is to search by most popular rather than a name search. With a limit of 20 terms to show up, this could mean the tag you are looking for does not show up on the list. This does not scale for sites with lots of terms of a taxonomy. We discovered it on one of our sites that has 13K tags.

Why?

For sites with lots of tags, especially similarly spelled tags, it could result in the term not appearing in the autocomplete.

How?

Since this is a search by name, it should have an orderby name and order asc to ensure the term you are searching for appears in the list.

Testing Instructions

  1. Add a bunch of tags with similar name (test, test1, test2, etc)
  2. Assign one of those tags to a post (say test3)
  3. When searching for tag and you type test, the first item will be test3 with current code
  4. In pull request the search will go by name / asc so it will be test as the first item (which is what someone would expect)

Current
Screen Shot 2023-02-06 at 11 40 36 AM

Fix
Screen Shot 2023-02-06 at 11 41 52 AM

…rch like a tag cloud rather than a name search. Does not scale for sites with lots of terms of a taxonomy.
@Mamaduka Mamaduka self-requested a review February 6, 2023 17:44
@Mamaduka Mamaduka added [Type] Enhancement A suggestion for improvement. [Feature] Document Settings Document settings experience labels Feb 6, 2023
Copy link
Member

@Mamaduka Mamaduka left a comment

Choose a reason for hiding this comment

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

Thank you, @mauteri!

I think query changes make sense here. The order: asc and orderby: name are default arguments for the request, so I think we can even omit those.

P.S. Rebasing on the top of the trunk, should fix the failing React Native tests.

@mauteri
Copy link
Contributor Author

mauteri commented Feb 8, 2023

Thanks @Mamaduka! Just committed those changes. :-)

Copy link
Member

@Mamaduka Mamaduka left a comment

Choose a reason for hiding this comment

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

Thank you, @mauteri!

@Mamaduka Mamaduka merged commit bb6ddd7 into WordPress:trunk Feb 8, 2023
@github-actions github-actions bot added this to the Gutenberg 15.2 milestone Feb 8, 2023
@mauteri mauteri deleted the feature/term-sorting branch February 8, 2023 20:20
@msaari
Copy link

msaari commented Sep 6, 2023

Is it possible to adjust this to get back the original behaviour? On a site with 10k tags, this change was a huge step backwards in usability. Having the most common tags show up first was very important to make the users use the most common tags. Can I use a filter somewhere to get the count rank back?

@mauteri
Copy link
Contributor Author

mauteri commented Sep 6, 2023

One of the main issues was tags not even showing up in the search when you have many similarly named as it caps the number to choose from to 20. You could type the whole tag name and it wouldn't appear in the list (like it didn't exist). I think that's a bigger issue.

@msaari
Copy link

msaari commented Sep 6, 2023

For me, it's definitely the smaller problem here by a wide margin, but yeah, I can see that may not be the majority view (in our case, similar but more common would be preferable to exact but rare). But I wasn't asking to roll this back; I was asking for a method to adjust this locally. But as this comes from JS, looks like there isn't a filter I can use to adjust this. Having some way to control this locally would be great.

@mauteri
Copy link
Contributor Author

mauteri commented Sep 6, 2023

I think a filter would make sense for your needs, but yeah, I think majority of sites would expect the order to match what is being searched for.

@mauteri
Copy link
Contributor Author

mauteri commented Sep 6, 2023

I'll try to put in a PR for a filter here sometime in the next week.

@mauteri
Copy link
Contributor Author

mauteri commented Feb 12, 2024

Follow up PR to this one #58941 (cc @msaari)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Document Settings Document settings experience [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants