tags:

views:

282

answers:

3

Hi,

I am working with mysql full text search but find it lacking in situations where your string is part of a word within a field. If my filed is New York Times and I search for 'Time' I get no results. The hackish way to solve this is to set up two queries, one that does a full text search and the other than does SELECT * FROM ___ WHERE 'string' LIKE %..% search. Is there any way that I can set up my full text search to solve this issue so i don't have to run the extra query.

+1  A: 

I've basically given up on MySql's full text search in favor of Sphinx -- a dedicated full-text search engine which implements MySql's network protocol so you can "interpose" it between your clients and a MySql server, losing nothing and gaining rich, serious full-text capabilities. Maybe it's not suitable for your needs (which you don't fully express), but I think it's at least work checking out!

Alex Martelli
Cool thanks a lot. Just to clarify my question. I have a field that is the New York Giants. If I add that to the fulltext index and then search "giant" nothing will come up. How can I use fulltext search to return results in cases like these? I'll check out Sphinx. Thanks for the heads up
Arnold
@Russ, you're looking for **stemming** plugins (for mysql 5.1, 5.0 didn't support them), e.g. http://www.mnogosearch.org/doc/msearch-udmstemmer.html .
Alex Martelli
Thanks so much Alex, I appreciate the help. Unfortunatley, my hands are bound and I cannot upgrade to mysql 5.1. But I'm a bit confused, i undersatnd that in 5.0 I can't use customer parsers but does this mean that there is no native mysql method to do stemming in 5.0?
Arnold
@Russ, yep, that's what MySql's docs say -- plugins to full text search, e.g. for stemming, were only introduced in 5.1. I recommend Sphinx, anyway;-).
Alex Martelli
+1  A: 

You can use wild cards in your full text search. More info here

SELECT * FROM _____ WHERE MATCH (title) AGAINST ('time*' IN BOOLEAN MODE);
james.c.funk
hmmm nice nice. I didn't think of that. Only issue is that its a poor substitute for stemming since it won't match "timing" and words like that. I opted to do both a fulltext search and a LIKE %...% string matching search. Its a bit tedious and is extra querying but generates fairly solid results.
Arnold
A: 

I think it also does not match "quicktime"? am I right?

It looks as tho the fulltext can find the appended text but not the prepended.

For example, if the word in db is "timeline", then fulltext finds it if I search for "time*" but not if I search for "line*".

Any ideas?

Thanks,

chill