Page 1 of 1

PHP MYSQL FULLTEXT - Search problem with Apostrophe - ideas?

Posted: Thu Jul 13, 2006 8:23 pm
by idotcom
Hi all


I have a search form that searches my database for the query string using mysql's match and boolean.

The problem I found is this:

Say I have a record: Micheal's Fine Foods

Well if I search for micheal OR micheal's OR micheals no results are found. Yet, if I search for micheals fine foods, it will show the row with every other row that has the words fine or foods.


Is there any way to overcome this? Without having to replace every apostrophe in the database?


Any input appreciated... I need to fix this.

Thank you in advance!

Posted: Thu Jul 13, 2006 8:41 pm
by HomerTheDragoon
yah there is theres a near function or somthing like that... 1 sec let me go find it, ill edit in a second.


SELECT * FROM tablename WHERE fieldname LIKE '%$string%'
alright, if u have % before and not after, it will find anything with the string you have as long as its the last word. Or if u have a % after then it will onlt find stuff with the first word your string. If you have them on both sides, it will find it with the word anywhere.

Posted: Thu Jul 13, 2006 9:44 pm
by Burrito
using MATCH and AGAINST typically requires more than one word in the search (full text searching). That's why you're not returning anything with just 'michael' etc.

searching for 'michael's fine foods' might return more than one row, but if you order it by relevance, the one you want will show up first so you could limit your query to only one result if that's what you're after.