Solved

FULLTEXT exact matching problem with a comma separating the words

Posted on 2011-09-29
8
368 Views
Last Modified: 2012-08-13
Hi all,

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)

Open in new window


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
0
Comment
Question by:dolythgoe
  • 4
  • 3
8 Comments
 
LVL 8

Expert Comment

by:PranjalShah
ID: 36818845
Try creating a full text index on your table with that column

ALTER TABLE table_name ADD FULLTEXT(columnName)

 
0
 

Author Comment

by:dolythgoe
ID: 36818850
That has been done - I don't think you can run the query without one!
0
 
LVL 59

Accepted Solution

by:
Kevin Cross earned 250 total points
ID: 36818949
The problem is that punctuation is not treated as stop words, but I do not have a good answer how to fix that; however, you can see if this blog is helpful: http://thenoyes.com/littlenoise/?p=91
I believe the author is an EE member, but I have not seen him posting in a bit.
0
 

Author Comment

by:dolythgoe
ID: 36818954
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..
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 

Author Comment

by:dolythgoe
ID: 36818964
Ah thanks - soz, saw your post after mine! Will check it out and be back...
0
 
LVL 59

Expert Comment

by:Kevin Cross
ID: 36818967
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.
0
 

Author Comment

by:dolythgoe
ID: 36819017
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.
0
 
LVL 59

Expert Comment

by:Kevin Cross
ID: 36819031
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
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Foreword This is an old article.  Instead of using the MySQL extension that was used in the original code examples, please choose one of the currently supported database extensions instead.  More information is available here: MySQLi / PDO (http://…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now