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

Using key names in query returns all data as valid #22

Open
sn3h opened this issue Jun 5, 2020 · 2 comments
Open

Using key names in query returns all data as valid #22

sn3h opened this issue Jun 5, 2020 · 2 comments

Comments

@sn3h
Copy link

sn3h commented Jun 5, 2020

Hello,

first of all, thank's for this awesome plugin...

I use it with useFlexSearch from react-use-flexsearch but I am unable to find out why this happens and how to get rid of it.

Let's say I have data:
[{ first_name: "Alpha" last_name: "Beta" },{ first_name: "Beta" last_name: "Gamma" }]
and config set to engine: "flexsearch", engineOptions: { encode: "icase", tokenize: "strict"}

Everything works fine (with query 'Alpha' || 'Delta' returns 1 result, 'Beta' 2), but query 'first_name' or 'last_name' returns both objects as result. When I use more advanced tokenization, even 'first' returns everything, etc.

Any idea how to get rid of this behavior? It's getting problematic when I have "email" as a key and values like "@email.de" which then shows all users. I am clueless how to approach this.

Thank you very much.

@angeloashmore
Copy link
Owner

Hm, I'm not sure to be honest. It definitely makes sense that it should only be searching the values of the objects, not the keys.

I imagine this is something directly with the FlexSearch index rather than the Gatsby plugin or react-use-flexsearch hook.

Please share if you find a setting that disables that. 👍

@tkatchenko
Copy link

For what it's worth I'm also seeing this issue on Lunr as well as FlexSearch when testing.

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