Developer docs API: search does not work as expected

Hi @stevebaer

I was searching on and filled in a term that apparently does not occur in the docs, but it still gave me a lot of results. It looks like it performs a “does this set of characters exist anywhere on the page”, and I’d much rather it returned no results. Just try it with “doesnotexist” in the search field, it returns about 20 or so results, while I expect this (google link).

1 Like

It simply is not accounting for spaces when running the search apperently.
If you reorder the characters it will not find the same results, and every page listed has the string “does not exist” simply when parsing the page for the search function spaces are not accounted for.
It works as intended anyway, It’ll always find the result you’re looking for given this explanation.
Interesting find though

@menno I will need to ask @mkarimi how it works exactly, but it looks like it’s using a similar system that Rhino uses for typing commands, where it guesses the correct command, even if you type it wrong or partially wrong. What might help is if it was clear that a suggestion is a non exact match, what’s your thought about this?

Hmm… inexact matches can maybe be done based on Hamming distance of space-delimited strings? It looks like currently search tokens are not space delimited, so if the letters in ‘doesnotexist’ appear anywhere on the page, it will be a hit. I find this confusing.

We’re using fuse.js which is a popular search library that many websites use. Search is fuzzy so inexact matches will work to some degree. We look for matches in member name and namespace.

Since we’re using fuzzy search, there’s always going to be matches, we show the top 20 results. But I agree, we should filter out results that have very low scores.

I’ll work on fixing this.

This is fixed now.

1 Like