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
search: ranking results based on package status #4510
Conversation
This is a first cut for search result ranking. Within a group of search results of the same score, search results associated with the `base` package will come first, followed by those in `main-distribution`, and then everything else. Search results also have an additional indicator on the right border, which can be hovered to read the description. Unfortunately, it slows down `raco setup scribblings/main` by about 10 seconds. The command is invoked quite often, as it is run as a part of `raco pkg install` and `raco pkg remove`. It is unclear if the performance hit is a deal breaker. Fixes racket#4083 and issues raised in https://racket.discourse.group/t/whats-official-racket-and-whats-not/1447
Here's a self-contained program to optimize, if anyone wish to help speeding up the PR.
|
This pull request has been mentioned on Racket Discussions. There might be relevant details there: https://racket.discourse.group/t/whats-official-racket-and-whats-not/1447/32 |
If you haven't already, you might want to check the red/green being used for color-blind-friendly contrast. |
I'm happy to adjust the colors. Do you have any recommendation for the color hex codes or color names? |
A quick search turned up https://davidmathlogic.com/colorblind/#%23D81B60-%231E88E5-%23FFC107-%23004D40 which I liked |
The blue-yellow ones look pretty decent across four (or five) columns. I pushed a change to use them. Thanks for the feedback! |
Alright, adding even more caching fixes the performance issue. Now it runs in 2 seconds. |
So that it also contrasts well with the yellow highlighting
Here's one complication: For bindings, the associated package is accurate. For sections and tech terms, the associated package is a doc package. So we have a weird result where Should this be a concern? And if so, is there a solution? |
I'm in favor of the goal here. I have some minor quibbles if we stick to this implementation:
But I'm more concerned with the way the categories are currently derived. The package inference here works well, and I have no better idea given the documentation as-is. But it seems fragile and the long way around for information that should be declared. Given that the immediate goal is to treat main-distribution packages specially, it's within our reach to modify main-distribution documentation to declare the right information. Maybe documentation should start with an explicit declaration of the package that it's describing, for example, and have that propagated to index entries. The issue here seems related to the problem of reporting bindings with syntactic categories as needed for Rhombus. Maybe it's worth looking at extending index information for these goals (and, of course, trying to imagine future needs) at the same time. |
Gold and blue don't work well, because highlighted entries are colored light yellow, which doesn't contrast well with gold. What about blue and brown? Indeed, this is related to a couple of my pending PRs on the "kind information". In the PRs, I created a new However, the change that you suggest here would be far more involved. I think the problem stems from how |
Brown and blue sounds like it could work. Yes, I'm ok with deprecating the old |
I accidentally pushed this, because I forgot I had merged it locally to try out (and got distracted by a long message for a new commit). Although I'd really like to see a different implementation, this doesn't bother me enough to revert the commits. If it gets in the way of a different change, though, I can revert the merge. |
Got it. I am working on a different implementation, so I will submit further PRs to amend this PR. |
@sorawee I really appreciate this feature!! It has been confusing to find identically-named bindings from other packages rather than the ones from main distribution. While searching for (I don't know what is |
This is because "only bindings can be used for rexact matches" (where rexact is a special rank that comes before exact)
which is introduced in ecc43ff I do not know the justification for this, but it seems to be working as intended. |
@sorawee okay, thanks for the pointer! I'll play with it to see if it's possible to also include |
This PR should probably be closed as merged. Unfortunately, I think it resulted in some regressions in package installation. See eg https://plt.cs.northwestern.edu/pkg-build/server/built/fail/sketching.txt which fails with:
|
Will take a look, thanks! If it's difficult to fix, let's just revert it. Though if it's easy to fix, I'd prefer to make a quick fix. And in any case, let's close this PR. |
Initial investigation: this is due to how in Sketching, there's a Another observation: currently, https://docs.racket-lang.org/search/index.html?q=delay links to Sketching as the first result. However, the definition of From my understanding, Sketching doesn't define CC: @soegaard That being said, the |
There are several other packages that fail because of related errors, so I don't think it's about sketching in particular. |
It's a closely related problem, though not quite the same. My planned fix for Sketching does fix the problem with dropbox. I still want to better understand how these tags are generated before submitting a PR to fix the problem. In any case, it would also be nice to fix the dropbox documentation, which has many failed links, the underlying reason for the failure. CC: @stchang |
Fix the issues raised in racket#4510
Matthias ran into problems rendering documentation for a PLaneT package:
Since |
@shhyou: I agree with you though that this ranking could be unsatisfactory. The "hash code" tech term, for example, is the last entry (on my local machine), even though it's the exact match. So my plan, now that the PR is reverted, is to also revisit the ranking algorithm. Perhaps @elibarzilay could help us understand the motivation for "only bindings can be used for rexact matches". |
This is a first cut for search result ranking.
Within a group of search results of the same score, search results associated with the
base
package will come first, followed by those inmain-distribution
, and then everything else.Search results also have an additional indicator on the right border, which can be hovered to read the description.
Unfortunately, it slows down
raco setup scribblings/main
by about 10 seconds. The command is invoked quite often, as it is run as a part ofraco pkg install
andraco pkg remove
.It is unclear if the performance hit is a deal breaker.
Fixes #4083 and issues raised in
https://racket.discourse.group/t/whats-official-racket-and-whats-not/1447