Does anyone know of a way of being ‘accent-insensitive’ when i do a
search?
For example, if i have a resource with the name “La Bohème”, and someone
searches for ‘boheme’ i want them to find that resource, even though the
‘e’
doesn’t have the accent. At the moment, it will only find it if they
search
for the properly accented version.
I guess soundex support for ferret is what I mean, but maybe there’s
another
way?
I just discovered the rather handy fuzzy searches, which i can do by
adding
(eg) “~0.6” to the end of my search term. So, this does the job (yay),
but
i’d still be interested in hearing if anyone else has solved this
problem in
a different way.
You might create a custom Analyzer that does the job of replacing
accentuated characters with their non-accentuated counterparts. If you
apply this kind of analysis to both indexed content and queries, you’ll
find “La Bohème” with both ‘boheme’ and ‘bohème’ as the query string.
On Mon, Apr 21, 2008 at 05:49:43PM +0100, Max W. wrote:
For example, if i have a resource with the name “La Bohème”, and someone
searches for ‘boheme’ i want them to find that resource, even though the ‘e’
doesn’t have the accent. At the moment, it will only find it if they search
for the properly accented version.
I guess soundex support for ferret is what I mean, but maybe there’s
another way?
That’s very useful, thanks! I’m just using the fuzzy search for now,
but if
it proves too vague (too many false positive results) then i’ll look at
this.
I’d actually never seen that tr() method before, that combined with the
ready-made accent substitutions in your link is itself very handy!
cheers, max
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.