Click to See Complete Forum and Search --> : Mysql apostrophe search


rpcarnell
11-02-2007, 08:03 AM
I wrote a search engine using mysql, and one thing I have noticed is that mysql sees a difference between é and e.

That means that if I search for Mágdalena, and there's a Magdalena in the database, the latter won't be found.

I thought about using str_replace from PHP to remove the á,é,í, but that wouldn't work if there's a mágdalena in the database.

How do I solve this?

____________________________________________________________
http://www.carbotek.org

BrainDonor
11-02-2007, 10:13 AM
search for both? if someone adds an accent to a letter search the DB for that...then strip it out and search again without the accent?

just a thought.

rpcarnell
11-03-2007, 12:08 AM
But what if I want Mysql to not be able to tell the difference between á and a? Can that be done without replacing á with a, for example?

BrainDonor
11-03-2007, 07:12 PM
I found snippet below here: http://search.mnogo.ru/doc33/msearch-fuzzy.html


Accent insensitive search with MySQL

To configure mnoGoSearch for accent insensitive searches for German, French, Italian, Portuguese and some other Western languages, use the latin1_general_ci collation when creating the database you're going to use with mnoGoSearch:

CREATE DATABASE mnogosearch CHARACTER SET latin1 COLLATE latin1_general_ci;

With this collation, MySQL totally ignores all diacritic marks, so for example, searches for French "cote" will also find "coté" and vice versa.

rpcarnell
11-04-2007, 01:21 AM
Actually, I was having problems with Latin General, but I am not having any trouble with Latin_Swedish. With that format, there's no difference between a and á, etc.