FULLTEXT stopword problem

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
seodevhead
Forum Regular
Posts: 705
Joined: Sat Oct 08, 2005 8:18 pm
Location: Windermere, FL

FULLTEXT stopword problem

Post by seodevhead »

Hey guys... happy thanksgiving!

I have a column in a table I want my visitors to perform fulltext searches on, however the contents of this column are model numbers like so:

Lp-233 Gold
Tz-100 Silver
Ma-100 Gold
Pe-500 Platinum


Most of my visitors will probably just want to search 'Lp-233' for example. The problem is '-' (hyphen) is a FULLTEXT stopword and because of this, no results are being returned. Is there a way to make '-' (hyphen) not a stopword?? Thanks for your help! Take care and happy holidays!
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

MySQL Manual wrote:To override the default stopword list, set the ft_stopword_file system variable. (See Section 5.3.3, “Server System Variables”.) The variable value should be the pathname of the file containing the stopword list, or the empty string to disable stopword filtering. After changing the value of this variable or the contents of the stopword file, rebuild your FULLTEXT indexes.
I believe this will also work if you do what they say, but put it in your my.cnf file (on my systems that's stored in /etc/my.cnf which is the default).
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
User avatar
seodevhead
Forum Regular
Posts: 705
Joined: Sat Oct 08, 2005 8:18 pm
Location: Windermere, FL

Post by seodevhead »

Hey... I'll take a look into that. Is there anything I can do just in my php scripting to cure this? THanks for your help.
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

Not that I know of. The documentation mentions the method of starting the mysql daemon with certain flags. Nowhere did I see comments about changing that directive at runtime.

Manual page: http://dev.mysql.com/doc/refman/5.0/en/fulltext-fine-tuning.html
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
User avatar
pedrokas
Forum Commoner
Posts: 32
Joined: Thu Jan 15, 2004 10:53 am
Location: Lisboa, Portugal

Post by pedrokas »

advise your users about the exception! and give then the solution!
"Lp-233" Gold
"Tz-100" Silver
"Ma-100" Gold
the engine uses the Word "Lp-233" to do the search!

in my intranet this how i did it!
Post Reply