olivernn / lunr.js

A bit like Solr, but much smaller and not as bright
http://lunrjs.com
MIT License
8.87k stars 547 forks source link

How to match a term within a word? #463

Closed WisdomSky closed 3 years ago

WisdomSky commented 4 years ago

For example, If I search demon, I would expect it to match both demon and demonstrated.

WisdomSky commented 4 years ago

I have a dataset containing information of items/monsters in a game. Most of them has terms that are glued together like houseboy. And when I search house, it won't show the houseboy in the results.

fex80 commented 4 years ago

Hey, @WisdomSky, sounds like you are looking to use wildcards, i.e. you could make your query house* or demon* to get the results you need.

WisdomSky commented 4 years ago

@fex80 thanks for the suggestion, I've already tried that but unfortunately it isn't working.

olivernn commented 4 years ago

As @fex80 mentions wildcards are the way to achieve what you are asking for.

I've already tried that but unfortunately it isn't working.

Are you able to provide a minimal reproduction showing how the wildcards are not working?

olivernn commented 3 years ago

Closing this now, I'm more than happy to re-open and help understand whether there is a bug in Lunr for your use case, but I can only do that if you provide a reproduction of the bug.