Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passing a search string to the serverless function returns the entire index #19

Closed
mattstratton opened this issue May 30, 2020 · 10 comments

Comments

@mattstratton
Copy link

Describe the bug
Passing a search string to the serverless function returns the entire index.

To Reproduce
This is reproducible in the demo link at https://netlify-plugin-search-index.netlify.app/.netlify/functions/search?s=web (the entire index appears to be returned).

This occurs when I attempted it on my own site as well, but I discovered it is happening with the demo link as well, so that is probably easier to reproduce :)

@swyxio
Copy link
Owner

swyxio commented May 31, 2020

hi Matt! hmm, weird bug! should need to be caught with the test suite.

@swyxio
Copy link
Owner

swyxio commented May 31, 2020

@hypervillain if you'd like to help with this one itd be much appreciated, i took a quick look and it seems we dont really have tests set up for this. might be a regression from one of our previous merges..

@mattstratton the other thing im considering is that this could be due to our use of fuzzy matching. a short string is easier to fuzzymatch loosely. you're expeciting it to work like a filter, probably. maybe we should add a "strict" mode, or make fuzzy search opt in rather than default.

@mattstratton
Copy link
Author

That could be! With our site the index is waaaay big so we can’t have the whole thing come back like that (it’s over 25 MB).

@hypervillain
Copy link
Collaborator

I'll take a look ✌️

@swyxio
Copy link
Owner

swyxio commented May 31, 2020

@mattstratton yea i get you. i wonder if we should offer an option to just bypass fusejs altogether and just use javascript's String.includes. do you care about sorting by any particular metric?

@mattstratton
Copy link
Author

To be honest I haven’t gotten that far yet, as this was the beginning of my POC to figure out what we want to do with search :)

(I appreciate the responses and your work on this plugin by the way!)

@swyxio
Copy link
Owner

swyxio commented May 31, 2020

np! tbh i did this in my final days at Netlify, am looking for a new owner/more maintainers as i pursue other things at aws. lmk if you end up using it!

@swyxio
Copy link
Owner

swyxio commented May 31, 2020

@mattstratton we have released #20 as v0.1.6 with a lower fuzzy match threshold and a new limit parameter that should help not return so many matches - since you're POCing you may have gone with another solution, pls reopen if you like this one and need more tweaks. as mentioned in that PR we can make the threshold and other stuff configurable but need user feedback on how people actually wanna use this thing

@swyxio swyxio closed this as completed May 31, 2020
@hypervillain
Copy link
Collaborator

It probably won't do miracles for small strings though, but that's probably a limitation with Fuse itself.

@swyxio
Copy link
Owner

swyxio commented Jun 1, 2020

yeah maybe we should offer fuzzy as an opt-in thing since it is probably slower than toLowerCase and includes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants