golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
124.06k stars 17.68k forks source link

x/pkgsite: support real-time fuzzy searching for packages #44116

Open myitcv opened 3 years ago

myitcv commented 3 years ago

What is the URL of the page with the issue?

https://pkg.go.dev/

What is your user agent?

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.40 Safari/537.36

Screenshot

Screen Shot 2021-02-05 at 06 04 32

What did you do?

Typed rogpe in the search box. I'm lazy when it comes to search and I like to do things in a fuzzy way, much like workspace symbol search in gopls.

In this case I was trying to quickly get to https://pkg.go.dev/github.com/rogpeppe/go-internal/testscript

I would like to have been able to type simply rogptes and that result be narrowed down based on a high fuzzy score.

What would you like to see?

Real-time, fuzzy search results presented below the input box, much like Google (GitHub etc)

Screen Shot 2021-02-05 at 06 05 25

What did you see instead?

There is no such feature. It's a request-response based approach at the moment.

findleyr commented 3 years ago

FWIW, I added a redis-based auto-completion before launch, but it didn't make it to prime-time and I haven't had time to work on it since -- see also #40549. If enough people are interested, perhaps it could be resurrected, in some form or another. Another solution would be to occasionally process the most popular packages, and put them in an in-memory trie on the frontend tasks.

The maintenance cost is definitely non-trivial though, so it would have to be a heavily used feature in order to be worthwhile.

myitcv commented 3 years ago

Thanks - I suspected this wasn't a novel idea!

The maintenance cost is definitely non-trivial though, so it would have to be a heavily used feature in order to be worthwhile.

Possibly a case where we won't know until we try?! 😄