simonw / simonwillisonblog

The source code behind my blog
https://simonwillison.net/
Apache License 2.0
188 stars 17 forks source link

Better sort order for tag autocomplete #459

Closed simonw closed 2 months ago

simonw commented 2 months ago

Following:

I want to show the tags with the most items first, not just the tags with the shortest length. But... if a tag is an exact match I want that to be listed first.

simonw commented 2 months ago

With help of GPT-4o: https://chatgpt.com/share/affb515a-caa7-4efb-a1a2-503530ed2911

simonw commented 2 months ago

https://simonwillison.net/search/?q=data demonstrates the exact-matches-first logic:

CleanShot 2024-07-03 at 22 28 40@2x

Also added this debug tool that shows results along with the SQL query:

https://simonwillison.net/tags-autocomplete/?q=data&debug=1