From 360d6e4b7ddcfbb203dced9883532bc4f39137e0 Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Mon, 9 May 2022 11:46:24 -0700 Subject: rustdoc: search result ranking fix --- src/test/rustdoc-js/path-ordering.js | 14 ++++++++++++++ src/test/rustdoc-js/path-ordering.rs | 9 +++++++++ 2 files changed, 23 insertions(+) create mode 100644 src/test/rustdoc-js/path-ordering.js create mode 100644 src/test/rustdoc-js/path-ordering.rs (limited to 'src/test/rustdoc-js') diff --git a/src/test/rustdoc-js/path-ordering.js b/src/test/rustdoc-js/path-ordering.js new file mode 100644 index 00000000000..4aee569b0f4 --- /dev/null +++ b/src/test/rustdoc-js/path-ordering.js @@ -0,0 +1,14 @@ +// exact-check + +const QUERY = 'b::ccccccc'; + +const EXPECTED = { + 'others': [ + // `ccccccc` is an exact match for all three of these. + // However `b` is a closer match for `bb` than for any + // of the others, so it ought to go first. + { 'path': 'path_ordering::bb', 'name': 'Ccccccc' }, + { 'path': 'path_ordering::aa', 'name': 'Ccccccc' }, + { 'path': 'path_ordering::dd', 'name': 'Ccccccc' }, + ], +}; diff --git a/src/test/rustdoc-js/path-ordering.rs b/src/test/rustdoc-js/path-ordering.rs new file mode 100644 index 00000000000..7843cf7f9dc --- /dev/null +++ b/src/test/rustdoc-js/path-ordering.rs @@ -0,0 +1,9 @@ +pub mod dd { + pub struct Ccccccc; +} +pub mod aa { + pub struct Ccccccc; +} +pub mod bb { + pub struct Ccccccc; +} -- cgit 1.4.1-3-g733a5