Support » Plugins » Hacks » Search whole words only with international characters

  • Hey,

    so the problem is following (talking about search query now):

    • I need to search for exact words only, not strings of characters inside a word
    • I’m running a slovak website, so if the client searches for “oci”, the results must show “oči” and “očí” as well

    I tried query parameters such as “s=xxx&sentence=1”, which still searches inside a word and “s=xxx&exact=1” which searches for exact words, but doesn’t support the second condition mentioned above.

    I didn’t find any solution until now, I’d really appreciate some help. Thank you 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • As far as I know, this kind of character mapping hasn’t been implemented yet, neither in PHP nor in mySQL. But maybe you can build on this approach:–/Collation-to-Charset-Table

    The wordpress search with default settings has this functionality – the problem is when using the “exact” search parameter… I’m trying to find a way around this… so basically I need the default wordpress search that doesn’t search for strings of characters inside words and it returns whole word matches only

    Moderator bcworkz


    You’ve tried the only two query vars that work with search. Your only recourse is to either hook the ‘posts_search’ filter and re-search the results for actual word matches using regexp, or completely replace the search function with your own.

    For reference, the search query is done in wp-includes/query.php around line 2197.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Search whole words only with international characters’ is closed to new replies.