You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd find it extremely useful if Fuse had the ability to ignore diacritics/accents both in the search string and in the indexed content. However, I don't want to lose the diacritics completely, i.e. I want the diacritics to appear in the search results for the matched items.
Based on the comments in a previous issue (#415), I have implemented a quick prototype (see below), but it falls short of being usable: the getter strips the diacritics and it's impossible to recover them from the results. (See below for an illustration.)
Describe the solution you'd like
Have a configuration option like ignoreAccents: boolean, disabled by default, that would toggle this functionality.
Describe alternatives you've considered
I have read through #415 and implemented a prototype in our app, but it has the problem of losing the diacritics. The implementation basically boils down to stripping diacritics from the search string and a custom getter which does the same to the content:
// Code by Mathieu TUDISCO via GitHub:// https://github.com/krisk/Fuse/issues/415#issuecomment-634348136conststripAccents=String.prototype.normalize
? ((str)=>str.normalize('NFD').replace(/[\u0300-\u036F]/g,''))
: ((str)=>str);constoptions={// ...getFn: (obj,path)=>stripAccents(Fuse.config.getFn(obj,path)),includeMatches: true,// ...};constfuse=newFuse(data,options);constsearchResults=fuse.search(stripAccents(this.searchString));
To illustrate the problem, see the screenshot below. The title of the first two items should be “Lesnatost v přírodních lesních oblastech” and “Proč dnes příroda tak rychle přichází o svou rozmanitost?”, respectively, but the diacritics are stripped by the getter and they cannot be recovered.
The text was updated successfully, but these errors were encountered:
Is this a feature that would be welcome by the maintainers but there's not enough capacity to implement it? If so, I would be happy to take a look and try to submit a patch myself.
Description
I'd find it extremely useful if Fuse had the ability to ignore diacritics/accents both in the search string and in the indexed content. However, I don't want to lose the diacritics completely, i.e. I want the diacritics to appear in the search results for the matched items.
Based on the comments in a previous issue (#415), I have implemented a quick prototype (see below), but it falls short of being usable: the getter strips the diacritics and it's impossible to recover them from the results. (See below for an illustration.)
Describe the solution you'd like
Have a configuration option like
ignoreAccents: boolean
, disabled by default, that would toggle this functionality.Describe alternatives you've considered
I have read through #415 and implemented a prototype in our app, but it has the problem of losing the diacritics. The implementation basically boils down to stripping diacritics from the search string and a custom getter which does the same to the content:
To illustrate the problem, see the screenshot below. The title of the first two items should be “Lesnatost v přírodních lesních oblastech” and “Proč dnes příroda tak rychle přichází o svou rozmanitost?”, respectively, but the diacritics are stripped by the getter and they cannot be recovered.
The text was updated successfully, but these errors were encountered: