Sorry, we don't support your browser.  Install a modern browser

Search transliteration

A

A simple, yet powerful, option that I think is missing in the $site->search() method is the option to enable transliteration (if not enabled by default).

I’m Portuguese, and like many languages, we have accented characters. Currently, if there is a page with a title “Música” (which means music) and I search for “musica” (without the accented character) the page is not found. Only when searching with “música”.

This is more relevant when handling non-latin alphabets. For example, “cat” in Japanese can be written as “猫” (kanji), “ねこ” (hiragana) or “neko” (romaji/latin).
With transliteration, all forms would resolve to the latin version (neko).

As a suggestion, I think this can be easily achieved with a library like Symfony String component, with special attention to the section with a transliteration example.

I always end up creating a custom search method (based on the existing one), and always transliterate both the user input and the pages content before querying for results, and it works great.

Thank you.

2 months ago