Solved

FULLTEXT exact matching problem with a comma separating the words

Posted on 2011-09-29
8
371 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
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: 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

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
MYSQL/PHP inserting 1969-12-31 instead of NULL 12 46
[MYSQL]: Delete is very slow 4 54
mysql joining from the same table 6 32
sql_mode 1 18
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://…
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

910 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

19 Experts available now in Live!

Get 1:1 Help Now