Page 1 of 1

3-character-long php search engine problem

Posted: Mon Aug 15, 2005 7:48 pm
by luchosoto
Hi everyone, I'm new to this forum and I hope there'll be someone out there who can help me out with this one.

Sometime ago I created a simple php search engine that searches for keywords in a MySQL database. (I'm using the MATCH - AGAINST method, and I don't wanna use the older method). Everything was doing fine until I had to move to another server. The problem now is that my search engine only searches for keywords longer than 3 characters. I wanna search for "dvd", for example, and my script finds nothing, but when I was in the previous server, it did.

I can't seem to find a solution for this problem and every solution I've tried has been to no avail. I'm pretty sure this has something to do with the server. :oops:

Can anyone help me out there?
Thanks beforehand.

ps: I've attached the sql query of my script.

Code: Select all

$results = mysql_query("SELECT * FROM Items WHERE MATCH (ItemName,ItemDescription) AGAINST ('$q' IN BOOLEAN MODE) LIMIT $page, $limit");

Posted: Mon Aug 15, 2005 7:53 pm
by feyd

Posted: Mon Aug 15, 2005 9:27 pm
by luchosoto
Uhmm, that seems to be the problem, thanks a lot, but Where can I find that line??

[mysqld]
ft_min_word_len=3

Is it in a file?
And what if that line is in a file I have no access to? b/c I've asked for help from the server administrators themselves, but they told me to locate a php.ini file within the same directory as my script...actually I didn't know what to do with the file, it was endless!

It also says I have to reset the server?? ohh no can do I guess...

isn't there any way to override the "ft_min_word_len" line??

I would appreciate any suggestions, solutions or workarounds.

Posted: Mon Aug 15, 2005 9:42 pm
by feyd
it is a server start up option. There is no way of dynamically changing the setting.

you may be able to use a simple word breaking to isolate any orphan three letter words in a search request and use the LIKE or REGEXP keywords. That may be the easiest solution.. although you could technically roll your own fulltext search system too..

Posted: Tue Aug 16, 2005 4:33 am
by onion2k
I go through the search terms and report back to the user if they've entered anything that's not going to return a result (short words, stop words, very long phrase searchs). So long as the user is kept informed they'll not have a problem with things not searching well.

That said, I also do a LIKE search if the user has only entered a short word.