Autocomplete: sort items more intelligently #248
Taitava
started this conversation in
Ideas - done & released
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Currently, the autocomplete menu's items are sorted alphabetically. I'd like the soring to be smarter.
E.g, if I'm typing
{{filena
, currently the autocomplete items' sort order is:{{event_file_name}}
{{event_old_file_name}}
{{file_name}}
But I'd like
{{file_name}}
to come before{{event_file_name}}
and{{event_old_file_name}}
, because I use it more often, and if I would have wanted to use any of the event variables, I would have typede
near the beginning:{{efilena
.The sorting algorithm
I have tried out different ideas on how to order the list, and this is what I have decided now. I guess this description is really hard to follow. I just want to write up something about it.
{{
/{{!
beginning), compare lengths. A shorter item is preferred, because the shorter the item is, the closer it matches to the search term.{{_field_using_variables}}
and{{_optional_field}}
. If I type{{_field
, I'd like{{_field_using_variables}}
to become first, but if the sorting would only take length into account,{{_optional_field}}
would win. I want the algorithm to pay more attention to items whose beginning matches the search term, and leave behind items who match the search term by their rear part.{{
/{{!
beginning) is not at least two characters long, use alphabetical ordering. Alphabetical ordering is also used if the boost weighted lengths are equal, but that's just a nyance.I might change it in the future
If any one of you have any feedback about the autocomplete sorting order, pleace comment freely in this discussion! You don't need to understand the current algorithm at all, just write about how the autocomplete list is currently ordered for you, and what item you'd like to see in a better position. 🌻
I'm open to improving the sorting, and I guess that this first sorting algorithm of mine won't be the last.
Beta Was this translation helpful? Give feedback.
All reactions