Commit Graph

65 Commits

Author SHA1 Message Date
Michael Howell
28db4ccda7 rustdoc-search: compressed bitmap to sort, then load desc
This adds a bit more data than "pure sharding" by
including information about which items have no description
at all. This way, it can sort the results, then truncate,
then finally download the description.

With the "e" bitmap: 2380KiB

Without the "e" bitmap: 2364KiB
2024-03-21 17:57:01 -07:00
Michael Howell
2e368bfe9e Fix style errors 2024-03-17 13:59:46 -07:00
Michael Howell
5b44bfda7f rustdoc-search: shard the search result descriptions
The descriptions are, on almost all crates[^1], the majority
of the size of the search index, even though they aren't really
used for searching. This makes it relatively easy to separate
them into their own files.

This commit also bumps us to ES8. Out of the browsers we support,
all of them support async functions according to caniuse.

https://caniuse.com/async-functions

[^1]:
    <https://microsoft.github.io/windows-docs-rs/>, a crate with
    44MiB of pure names and no descriptions for them, is an outlier
    and should not be counted.
2024-03-16 22:07:30 -07:00
Michael Howell
6b69ebcae0 rustdoc-search: remove parallel searchWords array
This might have made sense if the algorithm could use `searchWords`
to skip having to look at `searchIndex`, but since it always
does a substring check on both the stock word and the normalizedName,
it doesn't seem to help performance anyway.
2023-12-15 16:26:35 -07:00
Michael Howell
63c50712f4 rustdoc-search: add support for associated types 2023-11-19 18:54:36 -07:00
Michael Howell
6068850008 rustdoc: fix test case for generics that look like names 2023-09-03 13:06:08 -07:00
Guillaume Gomez
6b0c7c4f01 Change format of rustdoc-js tests by putting query and correction directly alongside the expected values 2023-06-09 17:00:47 +02:00
Michael Howell
4c11822aeb rustdoc: restructure type search engine to pick-and-use IDs
This change makes it so, instead of mixing string distance with
type unification, function signature search works by
mapping names to IDs at the start, reporting to the user any
cases where it had to make corrections, and then matches with
IDs when going through the items.

This only changes function searches. Name searches are left alone,
and corrections are only done when there's a single item in the
search query.
2023-04-17 12:16:54 -07:00
Michael Howell
e600c0ba0e rustdoc: add support for type filters in arguments and generics
This makes sense, since the search index has the information in it,
and it's more useful for function signature searches since a
function signature search's item type is, by definition, some type
of function (there's more than one, but not very many).
2023-03-20 22:41:57 -07:00
Guillaume Gomez
904d9c5c54 Improve rustdoc-js tester code clarity a bit 2023-03-11 21:40:17 +01:00
Guillaume Gomez
856c9bb481 Add eslint checks for rustdoc-js tester 2023-03-11 21:37:59 +01:00
Guillaume Gomez
0b5165e76d Clean up rustdoc-js tester.js file 2023-03-04 21:11:34 +01:00
Guillaume Gomez
6b0b65424a Update rustdoc-js test tool 2023-03-02 12:59:04 +01:00
Jacob Hoffman-Andrews
f9e1f6ffdf rustdoc: add hash to filename of toolchain files
All static files used by rustdoc are now stored in static.files/ and
include a hash of their contents. They no longer include the contents of
the --resource-suffix flag. This clarifies caching semantics. Anything
in static.files can use Cache-Control: immutable because any updates
will show up as a new URL.

Invocation-specific files like crates-NN.js, search-index-NN.js,
and sidebar-items-NN.js still get the resource suffix.

The --disable-minification flag is removed because it would vary the
output of static files based on invocation flags. Instead, for
rustdoc development purposes it's preferable to symlink static files
to a non-minified copy for quick iteration.
2022-10-29 12:47:48 -07:00
Jacob Hoffman-Andrews
453979462a rustdoc: make search.js a module
Previously, search.js relied on the DOM and the `window` object. It can now be
loaded in the absence of the DOM, for instance by Node. The same is true of
search-index.js.

This allows removing a lot of code from src/tools/rustdoc-js/tester.js that
tried to parse search.js and extract specific functions that were needed for
testing.
2022-05-17 09:26:18 -07:00
Guillaume Gomez
0233abebc8 Update rustdoc-js tester tool to work with new kind of variables 2022-04-24 15:36:34 +02:00
Guillaume Gomez
299e8ee25e Add an extra check over filter type 2022-04-18 21:43:19 +02:00
Guillaume Gomez
6f35475ba5 Parse idents the same way in both quote string elements and "normal" elements 2022-04-18 20:59:09 +02:00
Guillaume Gomez
e03a950747 Handle separators in their own functions and fix missing handling of tabs 2022-04-18 20:59:09 +02:00
Guillaume Gomez
8e29ed43d9 Add isIdentCharacter function to ensure that unexpected characters are handled correctly 2022-04-18 20:59:09 +02:00
Guillaume Gomez
49297337b4 Simplify parser syntax 2022-04-18 20:59:08 +02:00
Guillaume Gomez
99d552092c Make query parser more strict and improve display of errors 2022-04-18 20:59:08 +02:00
Guillaume Gomez
264064df36 * Greatly improve the rustdoc search parser source code
* Move all functions outside parseQuery
2022-04-18 20:59:08 +02:00
Guillaume Gomez
bbcf1762dd Improve naming of "val" field 2022-04-18 20:59:08 +02:00
Guillaume Gomez
7cefee027a Add possibility to check parsed query 2022-04-18 20:59:08 +02:00
Guillaume Gomez
17fe3068d2 Update tester to have FILTER_CRATE set to null if undefined. 2022-02-03 22:59:33 +01:00
Guillaume Gomez
10d65a9636 Allow to run a specific rustdoc-js* test 2021-11-09 17:41:51 +01:00
Guillaume Gomez
3f496b5f2e Simplify js tester a bit 2021-11-03 21:37:19 +01:00
Guillaume Gomez
cc319f88a7 Fix rustdoc-js tool string "parsing"
Improve tool: add support for multiline comments
2021-08-11 20:20:17 +02:00
Guillaume Gomez
18b7c0a00e Update rustdoc-js tools 2021-05-15 13:09:55 +02:00
Jacob Hoffman-Andrews
d44c6ed351 Updated tester.js for separate search.js 2021-04-13 16:43:14 -07:00
Michael Howell
227f5ed679 rustdoc: Separate filter-empty-string out into its own function 2021-04-01 12:17:43 -07:00
Guillaume Gomez
c013f2a735 Improve diff display in case the whole key in missing 2021-02-01 15:56:51 +01:00
Guillaume Gomez
1d1ab21ad9 Remove inline script tags 2021-01-18 12:03:53 +01:00
Guillaume Gomez
fa14f22fcb Improve rustdoc JS tests error output 2020-11-26 21:59:45 +01:00
Oliver Middleton
478750c1db rustdoc: Fix doc aliases with crate filtering
Fix a crash when searching for an alias contained in the currently selected filter crate.

Also remove alias search results for crates that should be filtered out.

The test suite needed to be fixed to actually take into account the crate filtering and check that there are no results when none are expected.
2020-06-23 09:27:37 +01:00
Guillaume Gomez
398511a135 Import missing functions from storage.js 2020-05-26 15:11:44 +02:00
Guillaume Gomez
c4d9318be6 Make current crate aliases go first 2020-05-14 11:36:02 +02:00
Guillaume Gomez
f581cf7544 Merge aliases and search-index 2020-05-07 20:08:08 +02:00
Guillaume Gomez
d80ac14fe6 Extend rustdoc-js tester to allow to test multiple queries in one file 2020-05-07 20:08:08 +02:00
Guillaume Gomez
426055cb29 Improve rustdoc js testers code 2020-04-14 13:40:11 +02:00
Guillaume Gomez
d6b75e0ef1 End cleanup on rustdoc-js tools 2020-04-11 16:32:28 +02:00
Guillaume Gomez
feb6635fe6 Clean up rustdoc js tester source code and move common code in one place 2020-03-21 13:39:49 +01:00
Guillaume Gomez
9b85213610 Add missing variable to load in non-std tester as well 2020-03-16 21:50:04 +01:00
Oliver Middleton
3f58ab6e24 Allow rustdoc-js and rustdoc-js-std to use none default build dir location 2020-03-13 23:24:12 +00:00
Guillaume Gomez
be23cd9a2d Move documentation build into bootstrap 2019-02-25 17:46:06 +01:00
Guillaume Gomez
aa3ca321e9 Rename rustdoc js test suites 2019-02-25 17:46:06 +01:00
Guillaume Gomez
834347ddaf Add rustdoc JS non-std tests 2019-02-25 17:43:57 +01:00
Mark Rousskov
e132d9066d Account for no newline before test annotations
Previously the license comment would always provide that newline but
since that's been removed this change is needed.
2018-12-26 09:00:55 -07:00
Mark Rousskov
2a663555dd Remove licenses 2018-12-25 21:08:33 -07:00