mysql full text strangeness

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
php3ch0
Forum Contributor
Posts: 212
Joined: Sun Nov 13, 2005 7:35 am
Location: Folkestone, Kent, UK

mysql full text strangeness

Post by php3ch0 »

I am having a problem with fulltext search of the database. It works 99% of the time but in some cases returns a 0 set of results when it should not. Is this a case of mysql reserved words or is there something else I am missing?

Code: Select all

 
$search = mysql_real_escape_string($_GET['search']);
 
        mysql_select_db($database_db_connect, $db_connect);
        $query_basic = "SELECT *, MATCH(name, keywords) AGAINST ('$search' IN BOOLEAN MODE) AS relevance FROM businesses WHERE MATCH(name, keywords) AGAINST ('$search' IN BOOLEAN MODE) and level='1' group by address1 order by relevance DESC";
        $basic = mysql_query($query_basic, $db_connect) or die(mysql_error());
        $row_basic = mysql_fetch_assoc($basic);
        $totalRows_basic = mysql_num_rows($basic);
 
The Search for "changes" returns 0 results even though it is mentioned in name and keywords. Other searches for other words in keywords and this record shows fine.

Thanks in advance for help
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: mysql full text strangeness

Post by VladSun »

http://dev.mysql.com/doc/refman/5.1/en/ ... words.html
Common words such as “some” or “then” are stopwords and do not match if present in the search string.
"Changes" is in the list ;)
There are 10 types of people in this world, those who understand binary and those who don't
User avatar
php3ch0
Forum Contributor
Posts: 212
Joined: Sun Nov 13, 2005 7:35 am
Location: Folkestone, Kent, UK

Re: mysql full text strangeness

Post by php3ch0 »

Thanks for that.

Is there anyway of editing the list on your own server so that I can search for this term?
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: mysql full text strangeness

Post by VladSun »

There are 10 types of people in this world, those who understand binary and those who don't
Post Reply