Open mx3coding opened 11 months ago
:unicorn:
When you search for "pao" it did not match the word "pão" (bread in portuguese), because of the "~" (tilde) in the "a" letter.
So I modified the file "lunr.js", inside "node_modules/@cmfcmf/docusaurus-search-local/lib/":
1) Added the function: String.prototype.toLowerCaseNormMx = function() { return this.normalize("NFD").replace(/\p{Diacritic}/gu, "") }
2) Replaced every ".toLowerCase()" for "toLowerCaseNormMx()"
Result: Now I can search for "accented words" without the need for the accent.
Disclaimer: I needed a quick fix ASAP, so I did the "wrong" way. So I am posting just in case it helps anyone.
:unicorn:
When you search for "pao" it did not match the word "pão" (bread in portuguese), because of the "~" (tilde) in the "a" letter.
So I modified the file "lunr.js", inside "node_modules/@cmfcmf/docusaurus-search-local/lib/":
1) Added the function: String.prototype.toLowerCaseNormMx = function() { return this.normalize("NFD").replace(/\p{Diacritic}/gu, "") }
2) Replaced every ".toLowerCase()" for "toLowerCaseNormMx()"
Result: Now I can search for "accented words" without the need for the accent.
Disclaimer: I needed a quick fix ASAP, so I did the "wrong" way. So I am posting just in case it helps anyone.