-
Notifications
You must be signed in to change notification settings - Fork 6
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
Option to ignore accents (diacritics) #9
Comments
Yes, handling diacritics is on my todo list. I'm no expert, but based on some investigation, it seems like In the meantime, you could add strings without diacritics and then search on those values instead of the original ones, but show the original ones when rendering the results list. I'm not sure how your data is structured and am not familiar with the
And then you could show the original |
I’ve just tried Trick for scrubbed fields is a nice one, I will try that! Do you have ETA on when you would have first-class support for diacritics? |
Can you give me some examples of strings where doing
I believe that should break the characters into an ASCII character and a diacritic character, and then remove the diacritics.
Shouldn't it be sufficient to apply the same diacritic removal approach to the query string before searching, as you do in your code example? Maybe I'm misunderstanding something. There are some additional approaches I've looked at: It shouldn't be hard to add the diacritic filtering, once I've decided what the right approach is. That I'm also not sure if I want to include it as a dependency, for those who don't need it. |
Third character, but that can be achieved with custom character replacement.
Yeah, this should probably be optional and implementation shouldn’t be diacritics specific, maybe something along the lines of function which has one argument (original) string, and returns processed string (which can be anything, and in this case, diacritics are removed). |
Thanks for the example. I see what you mean. I've pushed a branch that includes the preprocessor function option. You could use that with the latinize package to create a simple function that would remove all the diacritics. Something like:
I'll throw together an example repo that does this. |
I created this repo, which uses the version of QuickScore from the |
@fwextensions sorry it took so long for me to check this! I’ve tried it and this works! I think this could be great addition to package. |
No worries, thanks for trying it out! This does seem like the simplest approach. I'm planning on adding this feature to the library. Just trying to decide between |
|
Sorry for the delay! This functionality is now in the latest package on npm. |
I’m using quick-score in accents/diacritics supported language (Croatian). Sometimes I will search with diacritics, sometimes not, but it would be nice to normalize string which is used to search items.
Currently, I’m using node-diacritics to remove/replace diacritics to standard ASCII characters, on search query and on results, but this returns results where diacritics are already removed instead of original item.
Maybe add option to transform query and item string?
The text was updated successfully, but these errors were encountered: