krisk / Fuse

Lightweight fuzzy-search, in JavaScript
https://fusejs.io/
Apache License 2.0
18.05k stars 766 forks source link

how to limit search scope to certain directory #443

Closed vistad closed 4 years ago

vistad commented 4 years ago

Hello, do you know how to limit search to certain directory? Where is that config? I'm trying to configure Fuse.js search on my hugo website following model: https://www.ronaldsvilcins.com/2020/06/09/how-to-implement-search-in-hugo/. I have Content folder that holds data folders: Women, Men, Kids etc. A woman browsing women pages searches for shoes - she is interested in women shoes. But Fuse.js searches the whole site and returns all results - of Women, Men and Kids shoes. How to limit search scope by data directory or category? Thank you!

krisk commented 4 years ago

For future reference, these types of questions would better if asked on Stack Overflow, that way the everyone can benefit, but also the question is bound to get wider reach (and thus an answer from someone other than me 😄 ).

Sounds like what you could do is use logical query operators to restrict the search to whatever keys (and thus category) you want.