yukang
03b453cda3
Fix no results when searching for == in doc
2026-04-07 19:32:43 +08:00
Michael Howell
f1d240c040
rustdoc-search: match path components on words
...
Since the length of a path is treated as sorting criteria, and
every path that contains the query without exactly matching it
must be longer, exact matches will always sort first if they exist.
2026-04-03 22:51:18 -07:00
Guillaume Gomez
8c4480953c
Correctly handle std "channels" in rustdoc-js tests
2026-04-02 16:23:38 +02:00
binarycat
7199a0bb9a
rustdoc: fix href of extern crates in search results
2026-04-01 16:36:47 -05:00
Guillaume Gomez
ab9e1da0a1
Add regression test for search_unbox inlined reexport
2026-02-27 20:14:20 +01:00
Guillaume Gomez
526c1afb5c
Correctly handle #[doc(alias = "...")] attribute on inlined reexports
2026-02-26 16:07:37 +01:00
binarycat
dca86a9521
rustdoc: sort stable items first
2026-02-13 14:44:41 -06:00
bors
7b9905edb4
Auto merge of #149370 - Zalathar:rollup-6fkk5x4, r=Zalathar
...
Rollup of 8 pull requests
Successful merges:
- rust-lang/rust#149238 (float:🗜️ make treatment of signed zeros unspecified)
- rust-lang/rust#149270 (implement `Iterator::{exactly_one, collect_array}`)
- rust-lang/rust#149295 (Suggest _bytes versions of endian-converting methods)
- rust-lang/rust#149332 (fix rustdoc search says “Consider searching for "null" instead.” rust-lang/rust#149324 )
- rust-lang/rust#149349 (Fix typo in comment.)
- rust-lang/rust#149353 (Tidying up UI tests [3/N])
- rust-lang/rust#149355 (Document that `build.description` affects symbol mangling and crate IDs)
- rust-lang/rust#149360 (Enable CI download for windows-gnullvm)
r? `@ghost`
`@rustbot` modify labels: rollup
2025-11-27 07:30:25 +00:00
Asuka Minato
48bd321a71
fix
2025-11-26 07:09:42 +09:00
binarycat
93526103ea
rustdoc: add regression test for #140968
2025-11-25 12:38:36 -06:00
Stuart Cook
c3171d19d5
Rollup merge of #147701 - lolbinarycat:rustdoc-search-alias-fix, r=GuillaumeGomez
...
rustdoc: don't ignore path distance for doc aliases
Ran into a bit of an issue due to the overloading of space (it needs to be a metachar for most searches, but not for doc aliases that have space in them). Not sure if I need to also need to account for other whitespace chars.
<img width="1778" height="494" alt="screenshot" src="https://github.com/user-attachments/assets/041e76f1-3b29-4de5-a72b-1431021fb676 " />
fixes https://github.com/rust-lang/rust/issues/146214
r? `@GuillaumeGomez`
2025-11-13 11:57:07 +11:00
binarycat
3ba87c4b33
rustdoc: expand regression test for #146214
2025-11-11 11:53:46 -06:00
Michael Howell
c8b2a9af2b
rustdoc-search: remove broken index special case
2025-11-05 23:41:43 -07:00
Guillaume Gomez
2a1595e2fe
Add regression test for including extern crates in import filtering
2025-11-01 00:13:19 +01:00
Michael Howell
978fd435ae
rustdoc-search: add an integration test for CCI
...
Part of https://github.com/rust-lang/rust/issues/130676
2025-10-27 11:57:32 -07:00
binarycat
07072812ca
rustdoc: account for path distance in doc aliases
2025-10-15 18:57:49 -05:00
binarycat
7a6274373c
rustdoc: add regression test for #140968
2025-10-14 14:38:07 -05:00
binarycat
28724dc541
rustdoc: add regression test for #146216
2025-10-14 14:36:01 -05:00
binarycat
d0dc603c39
rustdoc: add testcase for traitParent deduplication
2025-10-02 15:29:22 -05:00
Guillaume Gomez
04a1dd1c17
Add regression test for literal search on paths
2025-09-11 18:05:21 +02:00
binarycat
3501e4f3f2
rustdoc: add tests for raw pointers in type-based search
2025-08-21 17:50:12 -05:00
Michael Howell
8511e40e72
rustdoc-search: search backend with partitioned suffix tree
2025-08-15 10:26:03 -07:00
Guillaume Gomez
a195cf63b8
Revert "rustdoc search: prefer stable items in search results"
...
This reverts commit 1140e90074 .
2025-08-14 13:06:05 +02:00
Stuart Cook
cd1e82ac72
Rollup merge of #145100 - GuillaumeGomez:rank-doc-alias-lower, r=lolbinarycat
...
Rank doc aliases lower than equivalently matched items
Follow-up of https://github.com/rust-lang/rust/pull/143988 .
cc `@lolbinarycat`
2025-08-09 13:58:52 +10:00
Stuart Cook
48f5929604
Rollup merge of #141658 - lolbinarycat:rustdoc-search-stability-rank-138067, r=GuillaumeGomez
...
rustdoc search: prefer stable items in search results
fixes https://github.com/rust-lang/rust/issues/138067
this does add a new field to the search index, but since we're only listing unstable items instead of adding a boolean flag to every item, it should only increase the search index size of sysroot crates, since those are the only ones using the `staged_api` feature, at least as far as the rust project is concerned.
2025-08-09 13:58:42 +10:00
Guillaume Gomez
a34bd2baf5
Add regression test for doc alias matching vs equivalently matched items
2025-08-09 01:23:10 +02:00
Guillaume Gomez
c079c96877
Add test for aliases partial match
2025-07-16 14:27:22 +02:00
Trevor Gross
f8ab9343b8
Migrate some tests away from concat-idents
...
`concat_idents!` is in the process of being removed, but a few things it
is used to test will still be relevant. Migrate these tests to something
other than `concat_idents`.
2025-06-24 10:54:54 +00:00
binarycat
1140e90074
rustdoc search: prefer stable items in search results
...
fixes https://github.com/rust-lang/rust/issues/138067
2025-06-10 12:56:58 -05:00
lcnr
326b7e9a6b
yeet CanonicalVarInfo
2025-05-23 12:10:53 +00:00
Michael Howell
e013cf8afc
rustdoc-search: add unbox flag to Result aliases
...
Fixes #139665
2025-04-11 11:36:40 -07:00
Matthias Krüger
d9ba4bf6fe
Rollup merge of #134277 - notriddle:notriddle/inline-into, r=GuillaumeGomez
...
rustdoc-search: handle `impl Into<X>` better
This PR fixes two bugs I ran into while searching the compiler docs:
- It omitted an `impl Trait` entry in the type signature field, producing `TyCtxt, , Symbol -> bool`
- It didn't let me search for `TyCtxt, DefId, Symbol -> bool` even though that's a perfectly good description of the function I was looking for (the function actually used `impl Into<DefId>`
r? ``@GuillaumeGomez`` cc ``@lolbinarycat``
2024-12-16 20:00:20 +01:00
Michael Howell
246835eda4
rustdoc-search: let From and Into be unboxed
2024-12-13 11:05:30 -07:00
Michael Howell
f068d8b809
rustdoc-search: show impl Trait inline when unhighlighted
...
While normal generics can be skipped in this case, no-names need
something to show here.
Before: `TyCtxt, , Symbol -> bool`
After: `TyCtxt, Into<DefId>, Symbol -> bool`
2024-12-13 10:47:20 -07:00
Michael Howell
8200c1e52e
rustdoc-search: fix mismatched path when parent re-exported twice
2024-12-12 13:29:18 -07:00
Michael Howell
fa2e214a43
rustdoc-search: add standalone trailing :: test
...
Follow up for #132569
2024-11-17 08:07:16 -07:00
bors
e84902d35a
Auto merge of #133047 - matthiaskrgr:rollup-9se1vth, r=matthiaskrgr
...
Rollup of 4 pull requests
Successful merges:
- #128197 (Skip locking span interner for some syntax context checks)
- #133040 ([rustdoc] Fix handling of footnote reference in footnote definition)
- #133043 (rustdoc-search: case-sensitive only when capitals are used)
- #133046 (Clippy subtree update)
r? `@ghost`
`@rustbot` modify labels: rollup
2024-11-14 21:09:28 +00:00
Michael Howell
32500aa8e0
rustdoc-search: case-sensitive only when capitals are used
...
This is the "smartcase" behavior, described by vim and dtolnay.
2024-11-14 11:10:14 -07:00
Michael Howell
86da4be47f
rustdoc: use a trie for name-based search
...
Preview and profiler results
----------------------------
Here's some quick profiling in Firefox done on the rust compiler docs:
- Before: https://share.firefox.dev/3UPm3M8
- After: https://share.firefox.dev/40LXvYb
Here's the results for the node.js profiler:
- https://notriddle.com/rustdoc-html-demo-15/trie-perf/index.html
Here's a copy that you can use to try it out. Compare it with [the nightly].
Try typing `typecheckercontext` one character at a time, slowly.
- https://notriddle.com/rustdoc-html-demo-15/compiler-doc-trie/index.html
[the nightly]: https://doc.rust-lang.org/nightly/nightly-rustc/
The fuzzy match algo is based on [Fast String Correction with
Levenshtein-Automata] and the corresponding implementation code in [moman]
and [Lucene]; the bit-packing representation comes from Lucene, but the
actual matcher is more based on `fsc.py`. As suggested in the paper, a
trie is used to represent the FSA dictionary.
The same trie is used for prefix matching. Substring matching is done with a
side table of three-character[^1] windows that point into the trie.
[Fast String Correction with Levenshtein-Automata]: https://github.com/tpn/pdfs/blob/master/Fast%20String%20Correction%20with%20Levenshtein-Automata%20(2002)%20(10.1.1.16.652).pdf
[Lucene]: https://fossies.org/linux/lucene/lucene/core/src/java/org/apache/lucene/util/automaton/Lev1TParametricDescription.java
[moman]: https://gitlab.com/notriddle/moman-rustdoc
User-visible changes
--------------------
I don't expect anybody to notice anything, but it does cause two changes:
- Substring matches, in the middle of a name, only apply if there's three
or more characters in the search query.
- Levenshtein distance limit now maxes out at two. In the old version,
the limit was w/3, so you could get looser matches for queries with
9 or more characters[^1] in them.
[^1]: technically utf-16 code units
2024-11-13 12:04:46 -07:00
Michael Howell
9900ea48b5
Adjust ranking so that duplicates count against rank
2024-10-31 13:12:14 -07:00
Michael Howell
12dc24f460
rustdoc-search: simplify rules for generics and type params
...
This commit is a response to feedback on the displayed type
signatures results, by making generics act stricter.
Generics are tightened by making order significant. This means
`Vec<Allocator>` now matches only with a true vector of allocators,
instead of matching the second type param. It also makes unboxing
within generics stricter, so `Result<A, B>` only matches if `B`
is in the error type and `A` is in the success type. The top level
of the function search is unaffected.
Find the discussion on:
* <https://rust-lang.zulipchat.com/#narrow/stream/393423-t-rustdoc.2Fmeetings/topic/meeting.202024-07-08/near/449965149 >
* <https://github.com/rust-lang/rust/pull/124544#issuecomment-2204272265 >
* <https://rust-lang.zulipchat.com/#narrow/channel/266220-t-rustdoc/topic/deciding.20on.20semantics.20of.20generics.20in.20rustdoc.20search/near/476841363 >
2024-10-30 12:27:48 -07:00
Michael Howell
20a4b4fea1
rustdoc-search: show types signatures in results
2024-10-30 10:35:39 -07:00
Michael Howell
5c7e7dfe10
rustdoc-search: pass original names through AST
2024-10-30 10:35:38 -07:00
binarycat
09773b4f24
allow type-based search on foreign functions
...
fixes https://github.com/rust-lang/rust/issues/131804
2024-10-25 12:19:04 -05:00
Michael Howell
3699e939e8
rustdoc-search: allow trailing Foo -> arg search
2024-09-05 17:58:05 -07:00
Noah Lev
dac7f20e13
Add test for Self not being a generic in search index
2024-08-04 12:49:28 -07:00
Michael Howell
8865b8c639
rustdoc-search: use lowercase, non-normalized name for type search
...
The type name ID map has underscores in its names, so the query
element should have them, too.
2024-06-09 11:56:52 -07:00
Sunshine
ceaa42b817
Update tests
2024-06-07 11:55:52 +08:00
Sunshine
f9f51839e5
Tidying
2024-06-07 06:09:30 +08:00
Sunshine
dd5103bb68
Add test for PR #126057
2024-06-07 05:49:46 +08:00