dolythgoe
asked on
FULLTEXT exact matching problem with a comma separating the words
Hi all,
So I have a simple FULLTEXT query that performs an exact match:
Problem is, this sees "one,two" as an exact match when it isn't as there's a comma between them.
How can I get round this?
Cheers
David
So I have a simple FULLTEXT query that performs an exact match:
SELECT link_id FROM textdump
WHERE MATCH (link_tags)
AGAINST ('"one two"' IN BOOLEAN MODE)
Problem is, this sees "one,two" as an exact match when it isn't as there's a comma between them.
How can I get round this?
Cheers
David
ASKER
That has been done - I don't think you can run the query without one!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Found this on MySQL site:
Nonword characters need not be matched exactly: Phrase searching requires only that matches contain exactly the same words as the phrase and in the same order. For example, "test phrase" matches "test, phrase".
Hmm not helpful in my case! There must be way to match on the ',' as words are often delimited by them..
Nonword characters need not be matched exactly: Phrase searching requires only that matches contain exactly the same words as the phrase and in the same order. For example, "test phrase" matches "test, phrase".
Hmm not helpful in my case! There must be way to match on the ',' as words are often delimited by them..
ASKER
Ah thanks - soz, saw your post after mine! Will check it out and be back...
Yes, exactly. See if link above helps as it shows how to make some punctuation stop words. I am emailing who I believe the author is to see if he will post here, since I have not tried this out myself. If it works for you, then great. If not, then hopefully someone like that can confirm; however, per the documentation it is working as designed by MySQL as you have found.
ASKER
Uhhh, that's a bit of a ball ache :( ! I might just match anyway and then get php to check if there's a comma in it or not - it's only for a worker-type cron script so I might skip the character encoding bit.
Will award points - it's the right solution! Thanks.
Will award points - it's the right solution! Thanks.
Cool. Keep in mind too, you might be able to do this outside of FULLTEXT.
SELECT link_id
FROM textdump
WHERE link_tags LIKE '%one two%'
Kevin
SELECT link_id
FROM textdump
WHERE link_tags LIKE '%one two%'
Kevin
ALTER TABLE table_name ADD FULLTEXT(columnName)