Improve documentation search fuzziness

4a9f798
Opened by Joshua Olson at 2024-09-03 09:19:22

I'd love to see better searching. ~Besides the lack of search for the book itself,~ Search filters out some characters without telling you; e.g. C++ and [Unstable] are reasonable search terms, but the first gives false positives by using C and the second isn't indexed?

Related: the search box says that ? gives more options, but it just lists everything like a wildcard.

  1. 1 is a duplicate of https://github.com/rust-lang/rust/issues/22786

    Steve Klabnik at 2016-06-24 17:42:49

  2. @steveklabnik Thanks, I narrowed the issue a bit.

    Another example that brought me back here: searching for 'http' returns several results!

    ...for heap and help, which are 50% wrong.


    P.S. I still don't get what the search bar's '?' for more options... tip was supposed to mean, so does that deserve an issue?

    Joshua Olson at 2018-03-03 05:46:39

  3. You can quote the word if you don't want fuzzy search. (broken on stable though) https://doc.rust-lang.org/nightly/std/?search=%22http%22

    Shotaro Yamada at 2018-03-03 06:09:20

  4. P.S. I still don't get what the search bar's '?' for more options... tip was supposed to mean, so does that deserve an issue?

    Type ? on a doc page, and you'll get a modal.

    Steve Klabnik at 2018-03-04 18:28:09

  5. Ah, that explains the 'S' too. I wouldn't have tried them outside of the text box, because the hints were inside the text box. Cool, though!

    Joshua Olson at 2018-03-04 19:54:52

  6. Triage: the current rustdoc search uses basic Levenshtein edit distance when looking for items in the search index, with a maximum distance of 3 (unless the search term is a substring of the result). I'm not totally sure of other advances in fuzzy test searching, but if they can be implemented in JavaScript, we can certainly give them a shot.

    QuietMisdreavus at 2018-11-05 01:00:14