Support » Plugin: Highlight Search Terms » Search results found in page with accents are not highlighted

  • When I search for a string without accents, for example “telephone”, the page comes up in the search results, but “téléphone” is not highlighted. Is there any fix for this ?

    Thank you.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author RavanH

    (@ravanh)

    Accents should not be a problem. See https://status301.net/fr/?s=%C3%A9galement for example…

    Can you share a link to your site?

    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.

    Plugin Author RavanH

    (@ravanh)

    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…

    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.

    Plugin Author RavanH

    (@ravanh)

    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 😉

    • This reply was modified 2 years, 7 months ago by  RavanH.

    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.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Search results found in page with accents are not highlighted’ is closed to new replies.