about summary refs log tree commit diff
path: root/src/test/rustdoc-js/path-ordering.js
diff options
context:
space:
mode:
authorYuki Okushi <jtitor@2k36.org>2022-05-11 00:09:35 +0900
committerGitHub <noreply@github.com>2022-05-11 00:09:35 +0900
commitd34915f691ca78596f57fcb73bbc9de08675d65a (patch)
tree427f33b804831917de064889cf9cbe7477b04a4b /src/test/rustdoc-js/path-ordering.js
parent7274447c36949bb63bef0a78bc23f8842d8c7320 (diff)
parenta9a90d450d11a06dff8bc49a89352e733e904fcf (diff)
Rollup merge of #96879 - notriddle:notriddle/search-ranking, r=GuillaumeGomez
rustdoc: search result ranking fix

# Before

![image](https://user-images.githubusercontent.com/1593513/167477286-91049761-67f9-4a73-8fb7-09dbb19ca76c.png)

# After

![image](https://user-images.githubusercontent.com/1593513/167477345-6733bc0f-4bb2-4625-9f7f-094031e36414.png)
Diffstat (limited to 'src/test/rustdoc-js/path-ordering.js')
-rw-r--r--src/test/rustdoc-js/path-ordering.js14
1 files changed, 14 insertions, 0 deletions
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' },
+    ],
+};