From e534f47e955d3ab50191acb2fa4874bb4fb1cde6 Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Wed, 13 Nov 2024 15:26:57 -0700 Subject: [PATCH] Add descriptive comment for NameTrie --- src/librustdoc/html/static/js/search.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/librustdoc/html/static/js/search.js b/src/librustdoc/html/static/js/search.js index 1817492a7d6..6c2b264063d 100644 --- a/src/librustdoc/html/static/js/search.js +++ b/src/librustdoc/html/static/js/search.js @@ -1107,6 +1107,25 @@ class RoaringBitmapBits { } /** + * A prefix tree, used for name-based search. + * + * This data structure is used to drive prefix matches, + * such as matching the query "link" to `LinkedList`, + * and Lev-distance matches, such as matching the + * query "hahsmap" to `HashMap`. Substring matches, + * such as "list" to `LinkedList`, are done with a + * tailTable that deep-links into this trie. + * + * children + * : A [sparse array] of subtrees. The array index + * is a charCode. + * + * [sparse array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/ + * Indexed_collections#sparse_arrays + * + * matches + * : A list of search index IDs for this node. + * * @typedef {{ * children: [NameTrie], * matches: [number],