Zend Lucene Search and Accented Characters

I am trying to find a way in Zend_Search_Lucene to execute the following script:

Say we have a user, and her name is Aicha (pay attention to the special character). If I am looking for an index for Aicha (without the special derivative of i), I would like Aïcha to be returned in the results.

Is there anything special I need to do when indexing or searching to make this work? I read the decisions about normalizing data before indexing, replacing all special characters with normalized characters, but I would prefer not to go this route.

Thanks in advance, Gary

+6
utf-8 zend-framework lucene zend-search-lucene
source share
1 answer
function normalize ($string){ $a = 'ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞ ßàáâãäåæçèéêëìíîïðñòóôõöøùúûýýþÿŔŕ'; $b = 'aaaaaaaceeeeiiiidnoooooouuuuy bsaaaaaaaceeeeiiiidnoooooouuuyybyRr'; $string = utf8_decode($string); $string = strtr($string, utf8_decode($a), $b); $string = strtolower($string); return utf8_encode($string); } $passToIndexer = normalize(" Aïcha "); 

try to use this output of functions when creating an index, keep the actual value without indexing it =) I hope this helps, I honestly don't think there is another way.

+3
source share

All Articles