Skip to content

Commit

Permalink
Rollup merge of rust-lang#86746 - GuillaumeGomez:query-type-filter, r…
Browse files Browse the repository at this point in the history
…=notriddle

Fix rustdoc query type filter

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

r? `@notriddle`
  • Loading branch information
JohnTitor authored Jun 30, 2021
2 parents e52a0ec + 855923c commit f458d8f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/librustdoc/html/static/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,8 @@ window.initSearch = function(rawSearchIndex) {
results_returned[fullId].lev =
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) {
lev = 0;
}
Expand Down
12 changes: 12 additions & 0 deletions src/test/rustdoc-js-std/typed-query.js
Original file line number Diff line number Diff line change
@@ -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' },
],
};

0 comments on commit f458d8f

Please sign in to comment.