Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/pkgsite: improve search ranking heuristics or add a way to search by package name #51775

cespare opened this issue Mar 17, 2022 · 2 comments
NeedsInvestigation pkgsite/search pkgsite


Copy link

@cespare cespare commented Mar 17, 2022

What is the URL of the page with the issue?

What did you do?

I searched for constraints, slices, and maps on in hopes of finding,, and

What did you expect to see?

Since I'm searching for the exact package name, and the packages I'm looking for are from, 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. 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 -- 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, 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 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 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 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 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.

@gopherbot gopherbot added this to the pkgsite/search milestone Mar 17, 2022
Copy link

@seankhliao seankhliao commented Mar 17, 2022

As far as I can tell, the suggested syntax already works, as described by search help

/constraints does show packages ending in /constraints, and you can also search by partial match, eg exp/constraints

Copy link
Contributor Author

@cespare cespare commented Mar 17, 2022

@seankhliao oh, very good point. I hadn't considered that including a slash in the query is unlikely to match text apart from the import path.

However, the results of searching for /constraints, /slices, and /maps are pretty odd.

/constraints doesn't turn up at all, for some reason.


Though, as you pointed out, exp/constraints gives me exactly what I want:


Similarly, searching for /slices and /maps doesn't turn up and at all, even if I hit "Show more results".

@jamalc jamalc added the NeedsInvestigation label Mar 18, 2022
@hyangah hyangah added the pkgsite/search label May 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
NeedsInvestigation pkgsite/search pkgsite
None yet

No branches or pull requests

5 participants