golang / go

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

x/pkgsite: provide options for sorting search results by number of imports and stars on GitHub #36952

Open thejerf opened 4 years ago

thejerf commented 4 years ago

As requested on https://blog.golang.org/pkg.go.dev-2020: I have found godoc.org to be the best way to search for quality Go modules, significantly because it defaults to sorting by the number of imports (possibly informed by the number of stars).

Compare: https://pkg.go.dev/search?q=smtp

To: https://godoc.org/?q=smtp

Observe, for instance, that on godoc.org, Brad Fitz's smtpd server comes up early, whereas on pkg.go.dev the front page has several packages of much less importance, and smtpd shows up on page 17 after a lot of inner modules and minor forks and larger projects that just happen to have an "smtp" package. Prioritizing hits at the "top level" of the package is probably a good idea, too; github.com/blah/smtpd is much more likely to be what I'm looking for than github.com/blah/project/go/inner1/inner2/smtp.

I also routinely suggest this to newcomers as a way of locating modules for Go.

julieqiu commented 4 years ago

Thanks for the feedback! We sort by package imports currently, and are working to improve our search quality. If you have other examples of bad searches, feel free to post them on this issue.

mewmew commented 4 years ago

As suggested by @ALTree, I'm moving #37430 here as the two issues are quite related. The main difference is that -- rather than just changing the default sort order -- #37430 requests the feature to allow users to select search order, including ascending and descending.

Provide options for sorting search results by number of imports and stars on GitHub

From https://github.com/golang/go/issues/37430#issue-570206067:

This issue is a feature request for pkg.go.dev to provide options for sorting search results based on number of imports, number of stars (on GitHub), date of release, etc. Preferably, the user could also specify whether to have the search results presented in ascending or descending search order.

For an example of this functionality, see the GitHub search results:

The search option categories of pkg.go.dev would include sorting by:

Note, GitHub stars was a useful metric detailed by godoc.org, which currently seem to be absent from search results of pkg.go.dev.

screenshot_2020-02-25_00:10:03

alicemerrick commented 3 months ago

Based on internal research, social and activity signals that may be helpful for package selection: