-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Fix global search #46175
Fix global search #46175
Conversation
91cb73e
to
620a004
Compare
Seems like it messes with generics. |
620a004
to
cce9da2
Compare
Ok, generics are working again. Added comments to avoid removing the same code again. |
} else { | ||
return MAX_LEV_DISTANCE + 1; | ||
} | ||
} | ||
return lev_distance; | ||
return lev_distance;//Math.ceil(total / done); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm still wondering if I should return the lowest lev distance or if I should return the average lev value... Any preference?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can see how returning the average would be better, but i'm not sure how effective it will be. A user would need to search for something with multiple generics (which i'm not sure works right now? a search for Result<File, Error>
returns a lot of bad lev results before any of the functions that return that type show up) before the difference will even show up. I think we can leave this as-is for now and investigate it in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll leave the comment just in case then if you don't mind.
@@ -374,7 +375,7 @@ | |||
var valLower = query.query.toLowerCase(), | |||
val = valLower, | |||
typeFilter = itemTypeFromName(query.type), | |||
results = {}, | |||
results = {}, results_in_args = {}, results_returned = {}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really an issue with this PR, but I don't like how there's inconsistent var
styles being used with some functions having one var
per line, and others using commas like they're going out of style.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I grouped them by "theme". But if you want I can put each on a line.
src/librustdoc/html/static/main.js
Outdated
for (i = 0; i < results.length; ++i) { | ||
if (results[i].id > -1) { | ||
var added = false; | ||
var obj = searchIndex[results[i].id]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What kind of obj is this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same as anywhere else in the code using searchIndex
? :p How would you name it?
src/librustdoc/html/static/main.js
Outdated
var added = false; | ||
var obj = searchIndex[results[i].id]; | ||
obj.lev = results[i].lev; | ||
if (isType !== true || obj.type) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also not really an issue with this PR, but the isType !== true
in an if thing really isn't saving you any speed of !isType
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't care. In principle it's faster since the comparison is explicit.
src/librustdoc/html/static/main.js
Outdated
var out = []; | ||
for (i = 0; i < results.length; ++i) { | ||
if (results[i].id > -1) { | ||
var added = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line seems like it was left behind by accident.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch!
☔ The latest upstream changes (presumably #46081) made this pull request unmergeable. Please resolve the merge conflicts. |
cce9da2
to
0a12198
Compare
Rebased. |
@bors r+ |
📌 Commit 0a12198 has been approved by |
I suggest we backport this (and possibly #46081 also) to 1.23-beta, as search is broken on beta as well. |
I agree - if possible, i'd rather not break the search for docs that show up on stable. |
Let's move up the priority then. @bors: p=10 |
…eavus Fix global search Fixes #46021. r? @QuietMisdreavus
☀️ Test successful - status-appveyor, status-travis |
[beta] Doc search backports This is a backport of #46081, #46175, #46433, and #46672. They all merged cleanly but I haven't tried a build; let's see what Travis says. These PRs fix pretty annoying issues with doc search and so I think it's important they don't slip to stable, but these PRs have *NOT* been `beta-accepted` yet. cc @steveklabnik @GuillaumeGomez can you tag the docs team to talk about beta-acceptance?
Looks like we forgot to backport this to 1.23.0 (sorry about that!) so removing beta tags |
Er sorry looks like this was backported in #46886 |
Fixes #46021.
r? @QuietMisdreavus