Accents should not be a problem. See https://status301.net/fr/?s=%C3%A9galement for example…
Can you share a link to your site?
Thread Starter
jstand
(@jstand)
Hi,
As you say, accent searches are working. The problem is if I search without accents, words with accents are not highlighted. And yet, the page shows up in WordPress search.
Sorry, my site is currently in development mode on a local server, however you can see with your example: https://status301.net/fr/?s=egalement that également is not highlighted.
OK I see what you mean. 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.
This is an interesting case. Thanks for reporting it.
I’ll have to look into ways to make the plugin highlight both with AND without accents but it might be more difficult then it sounds…
Thread Starter
jstand
(@jstand)
Right, that was exactly what I was thinking. In case it could help, I stumbled upon this fiddle: http://jsfiddle.net/nHGU6/
Obviously, all of the accent conversions from WordPress, which can be found here: https://core.trac.wordpress.org/browser/tags/4.5.3/src/wp-includes/formatting.php#L1122 , would need to be added manually.
If I have time, I’ll see if I can integrate the idea and do a pull request on your GitHub.
Hey that’s indeed a much more interesting approach than I’ve seen so far. Most cases seem to do some search/replace in the original text instead of adding the accents in the search term(s) as regex.
If you can find the time to make that work and do a pull request it’ll be highly appreciated 🙂 but if not, this will at least make it to my todo list 😉
Thread Starter
jstand
(@jstand)
Perfect! For anyone wanting a fix for this, I have started to implement a fix here: https://github.com/RavanH/highlight-search-terms/issues/1 It’s not perfect (see the comments), so feel free to modify it.