ramda.github.io icon indicating copy to clipboard operation
ramda.github.io copied to clipboard

The ramdajs.com/docs/'s Filter input is not smart enough for filtering what I really want.

Open adispring opened this issue 7 years ago • 3 comments

When searching o in Filter input of ramdajs.com/docs/, what I really want is R.o, but it is not on top of the result list. Can anyone optimize the filter algorithm?

adispring avatar Jun 07 '17 12:06 adispring

Thanks for moving this issue. Looks like there is not much to the filter alg at the moment. It simply matches the input string vs. the list of functions, and hides any elements that do not match. This appears to be the code that does it:

https://github.com/ramda/ramda.github.io/blob/master/docs/main.js#L22

buzzdecafe avatar Jun 07 '17 12:06 buzzdecafe

I'm actually working on some related stuff. I'll get to this at some point soon-ish

kedashoe avatar Jun 07 '17 20:06 kedashoe

We can give each matched api with different weight using regex. For example, each api's weight starts with 0, if api's name begins with input characters, its weight +2; else if ends with input characters, weight +1. Then sort matched apis with weight and alphabetical order, weight first.

adispring avatar Jun 08 '17 00:06 adispring