RavanH / highlight-search-terms

Lightweight jQuery search terms highlighter script for WordPress
https://status301.net/wordpress-plugins/highlight-search-terms/
GNU General Public License v3.0
8 stars 3 forks source link

Search results found in page with accents are not highlighted #1

Closed listedegarde closed 3 years ago

listedegarde commented 7 years ago

WordPress internal search function returns the post with “également” even on a search for “egalement” without accent but the Hilite Search Terms plugin in turn ignores “également” when highlighting terms on the results page.

See: https://wordpress.org/support/topic/search-results-found-in-page-with-accents-are-not-highlighted/#post-8848255

A little update on my progress: here's a sample that can convert the search into non-accented letters and successfully highlight. http://jsfiddle.net/nHGU6/89/

listedegarde commented 7 years ago

I have started working on a fix here, but I will not push because I don't have time to finish it right now. https://github.com/listedegarde/highlight-search-terms/tree/search-with-or-without-accents

It's "good enough" for me for now, so I'll just be careful not to do any updates until a release is available that includes this or similar code.

RavanH commented 7 years ago

Thanks for sharing! :)

RavanH commented 7 years ago

Update: I found the WordPress internal function remove_accents() here https://developer.wordpress.org/reference/functions/remove_accents/ which I could consider implementing to modify/append terms to highlight. But I'm not sure how/where/when the internal search actually does such a conversion. It's not mentioned in the docs in any case...

Leaving this ticket open as it's still under consideration :)

RavanH commented 6 years ago

Hi @listedegarde have you been able to solve the oe / œ issue yet?

I've implemented accent lenient search highlighting to the script in the latest release but it is different from your approach. Yours seems to be a closer match to the WordPress core accent and special character filter so it would be preferable over the actual implementation... if the oe / œ issue was fixed :)