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.
This commit is contained in:
Michael Howell 2023-04-15 11:53:50 -07:00
parent 1a7132d4f8
commit 4c11822aeb
6 changed files with 353 additions and 203 deletions

View file

@ -9,6 +9,7 @@ function initSearch(searchIndex){}
/**
* @typedef {{
* name: string,
* id: integer,
* fullPath: Array<string>,
* pathWithoutLast: Array<string>,
* pathLast: string,
@ -36,6 +37,8 @@ let ParserState;
* args: Array<QueryElement>,
* returned: Array<QueryElement>,
* foundElems: number,
* literalSearch: boolean,
* corrections: Array<{from: string, to: integer}>,
* }}
*/
let ParsedQuery;
@ -139,7 +142,7 @@ let FunctionSearchType;
/**
* @typedef {{
* name: (null|string),
* id: (null|number),
* ty: (null|number),
* generics: Array<FunctionType>,
* }}