x/pkgsite: improve search ranking heuristics or add a way to search by package name #51775
Labels
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
pkgsite/search
Issues related to pkg.go.dev search functionality
pkgsite
Milestone
What is the URL of the page with the issue?
https://pkg.go.dev/search
What did you do?
I searched for
constraints
,slices
, andmaps
on pkg.go.dev in hopes of finding golang.org/x/exp/constraints, golang.org/x/exp/slices, and golang.org/x/exp/maps.What did you expect to see?
Since I'm searching for the exact package name, and the packages I'm looking for are from golang.org, I would expect my desired results to be near or at the top of the search results.
What did you see instead?
For
constraints
, the search worked pretty well. golang.org/x/exp/constraints was the second result.The first place result doesn't actually say "constraints" in the package name, import path, or top-level doc comment, but it does contain the word "constraints" in the README as well as a
Constraints
type.For
slices
the search worked less well -- golang.org/x/exp/slices was the 16th result. Most of the first 15 results do not contain the word "slices" in the import path; typically it appears in the README or documentation text.When searching for
maps
, golang.org/x/exp/maps doesn't even appear on the page. I have to hit "Show more results" and then the package is number 59.I think these search results could be improved. For a start, if the search query exactly matches the package name, I think that should push the ranking up a lot higher. Also, I think that golang.org packages ought to rank pretty highly in general.
As an alternative to changing the ranking, the search page could provide a special syntax for searching by exact package name. I appreciate that when I put in a full import path, it takes me directly to the page for that package -- but typing out
golang.org/x/exp/maps
is pretty tedious, so being able to type something shorter like/maps
and get shown a list of packages named "maps" would be pretty helpful.Finally, FWIW, a general comment about how I use the pkg.go.dev search functionality. One kind of search (we could call it a "discovery search") is where I type in a search concept hoping to find a list of popular packages related to this concept. For instance, I might type "b-tree" and hope to find the popular packages implementing a B-tree. This seems to be the main kind of searching that pkg.go.dev is optimized for. For me, these kinds of searches are exceedingly rare -- <1% of my search volume. For most searches, I know exactly the package that I want to call up, and I'm trying to get to the page as efficiently as possible, and I feel that the search tool could help me more in this regard.
The text was updated successfully, but these errors were encountered: