-
Notifications
You must be signed in to change notification settings - Fork 548
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
Inconsistent Results #328
Comments
@TomFoyster You're absolutely right - it is an issue with stemming. If you try stemming each of those variants with
I'm guessing the stemmer recognizes the |
@hoelzro Thanks for your reply. Yes, essentially we want any partial to match - I think I'm struggling to get my head around stemming - this is legacy code written by a contractor that we're now needing to support.
This is all part of an autocomplete system, so currently as the user types results appear and then disappear, and then reappear again when they finish typing the word. Massive thanks for your help, it's greatly appreciated. |
@hoelzro I've made some progress, but I'm not quite there. I've updated the fiddle to better show the issue; https://jsfiddle.net/mfzx2gq9/5/ I've experimented with some code I've found elsewhere, which has reduced the issue down to a single instance returning no results - If my understanding is correct, and based on the query methods in my example;
I think, while Lunr is obviously very powerful - it should never have been chosen for this function - unless someone can show me a query method that will work in the way I need? |
@TomFoyster Since this is part of an autocomplete system, it sounds like you need prefix search, and I would agree with your assessment that lunr probably isn't a good fit this task. If you don't need stemming itself (eg. normalizing |
As @hoelzro has suggested, removing the stemming is probably the right approach here, I've updated the fiddle to show how. Hopefully without stemming you should get results that make more sense in an autocomplete. Autocomplete wasn't the original intended use case for Lunr, I would hope it would at least be possible to get reasonable results with the right configurations though.
Yeah, that is going to be slow! That will result in 125,549 lookups against the index: lunr.TokenSet.fromFuzzyString("assistan", 6).toArray().length If speed is of a concern you can balance dropping the leading wildcard from the search, it will be a tradeoff though between speed and result accuracy/recall. I can put together a guide on the website about setting up queries/indexes for use in an autocomplete search that might help others in the future. |
Borrowing issue EDIT: Found it :)
|
Hi all, I'm having some issues with inconsistent results in Lunr.
Presuming I have 1 object in my store,
{ label: Assistant }
A search for
assist
yields one result, however a search forassista
yields none. In fact, there's no result forassistan
either, butassistant
returns the expected result.I've created a JSFiddle that replicates the issue;
https://jsfiddle.net/mfzx2gq9/1/
There are similar issues with the words
Nursing
andAccommodation
too.What's going on? Is this an issue with stemming? If so how can it be resolved?
The text was updated successfully, but these errors were encountered: