fulltext search relevancy does not work

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
knford
Forum Newbie
Posts: 2
Joined: Wed Jul 13, 2005 2:33 pm
Location: Plymouth, Minnesota USA

fulltext search relevancy does not work

Post by knford »

I'm trying to get the relevancy to return from this fulltext search, but it returns zero every time. The results appear and there are not any errors. I used phpmyadmin and setup and fulltext on the column "short_desc" using an alter statement. I am using the newest version of xammp, which uses Apache/2.0.53 (Win32) and PHP version 5.0.4. Here is the code, which I've reduced to the basics:

SELECT title, short_desc, MATCH(short_desc) AGAINST(\"$search\") AS score
FROM listings

Any help finding the solution so the relevancy is returned would be appreciated. thank you.
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

you are missing the WHERE clause in your query...
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Post by onion2k »

You should also be aware that certain words won't be searched by default, you have to alter the stopword list.. there's a list of the default word list here: http://dev.mysql.com/tech-resources/art ... ealed.html

Why that's not in the manual is beyond me. Plus, I'm sure there's some missing from that list. If I try to search for "search" it never returns proper results for me. (Might well be my code mind you).
knford
Forum Newbie
Posts: 2
Joined: Wed Jul 13, 2005 2:33 pm
Location: Plymouth, Minnesota USA

Solved!

Post by knford »

There were too few records in the table for the fulltext to compare and assign a relevancy value. You need at least a dozen records.
Post Reply