1
Fork 0

Rollup merge of #86746 - GuillaumeGomez:query-type-filter, r=notriddle

Fix rustdoc query type filter

I realized while reviewing #86659 that the type filter was broken on search so I'd prefer it to get merged before merging #86659.

r? `@notriddle`
This commit is contained in:
Yuki Okushi 2021-07-01 05:21:00 +09:00 committed by GitHub
commit f458d8f669
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 1 deletions

View file

@ -801,7 +801,8 @@ window.initSearch = function(rawSearchIndex) {
results_returned[fullId].lev = results_returned[fullId].lev =
Math.min(results_returned[fullId].lev, returned); Math.min(results_returned[fullId].lev, returned);
} }
if (index !== -1 || lev <= MAX_LEV_DISTANCE) { if (typePassesFilter(typeFilter, ty.ty) &&
(index !== -1 || lev <= MAX_LEV_DISTANCE)) {
if (index !== -1 && paths.length < 2) { if (index !== -1 && paths.length < 2) {
lev = 0; lev = 0;
} }

View file

@ -0,0 +1,12 @@
// exact-check
const QUERY = 'macro:print';
const EXPECTED = {
'others': [
{ 'path': 'std', 'name': 'print' },
{ 'path': 'std', 'name': 'eprint' },
{ 'path': 'std', 'name': 'println' },
{ 'path': 'std', 'name': 'eprintln' },
],
};