Solved

FULLTEXT exact matching problem with a comma separating the words

Posted on 2011-09-29
8
373 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

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
 

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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A lot of articles have been written on splitting mysqldump and grabbing the required tables. A long while back, when Shlomi (http://code.openark.org/blog/mysql/on-restoring-a-single-table-from-mysqldump) had suggested a “sed” way, I actually shell …
I have been using r1soft Continuous Data Protection (http://www.r1soft.com/linux-cdp/) for many years now with the mySQL Addon and wanted to share a trick I have used several times. For those of us that don't have the luxury of using all transact…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

773 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