Go Back   CodingForums.com > :: Server side development > MySQL

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-24-2009, 04:56 PM   PM User | #1
yebaws
New Coder

 
Join Date: Mar 2009
Posts: 10
Thanks: 2
Thanked 0 Times in 0 Posts
yebaws is an unknown quantity at this point
fulltext index

I've come up against another problem using searches of fulltext indexes and hope somebody can offer me a bit of advice....

One column has a CSV list of 2, 3 & 4 character initials - for example: "BL, BT, GL, IWM, NMM, NRA, TNA,". I want to be able to search for rows that contain ANY particular initials.

For example, I can build a string "BL, GL, TNA" with check boxes to search for all rows containing any of those initials. But mysql only indexes words of 4 or more characters by default. I've emailed my ISP to see if they can change the configuration to allow indexing of 2 character words, but I'm guessing that the answer will be "no" as it will probably require a server wide change. So is there a way around this?

Using LIKE won't work because a LIKE search for "BL, BT, GL, IWM, NMM, NRA, TNA," will only return a row that has exactly that string, and not one that just contains BL for example. I'm a bit stumped with this one.....
yebaws is offline   Reply With Quote
Old 03-24-2009, 05:55 PM   PM User | #2
bazz
Master Coder

 
Join Date: Apr 2003
Location: in my house
Posts: 5,211
Thanks: 39
Thanked 201 Times in 197 Posts
bazz will become famous soon enoughbazz will become famous soon enough
post your query so far and we may be able to help.


bazz
__________________
"The day you stop learning is the day you become obsolete"! - my late Dad.

Why do some people say "I don't know for sure"? If they don't know for sure then, they don't know!
Useful MySQL resource
Useful MySQL link
bazz is offline   Reply With Quote
Old 03-24-2009, 06:01 PM   PM User | #3
guelphdad
Super Moderator


 
guelphdad's Avatar
 
Join Date: Mar 2006
Location: St. Catharines, Ontario Canada
Posts: 2,629
Thanks: 4
Thanked 147 Times in 138 Posts
guelphdad will become famous soon enoughguelphdad will become famous soon enough
Normalize your data instead.
guelphdad is offline   Reply With Quote
Old 03-24-2009, 06:08 PM   PM User | #4
bazz
Master Coder

 
Join Date: Apr 2003
Location: in my house
Posts: 5,211
Thanks: 39
Thanked 201 Times in 197 Posts
bazz will become famous soon enoughbazz will become famous soon enough
Oh, I missed that bit where he said
Quote:
One column has a CSV list of 2, 3 & 4 character initials ....
__________________
"The day you stop learning is the day you become obsolete"! - my late Dad.

Why do some people say "I don't know for sure"? If they don't know for sure then, they don't know!
Useful MySQL resource
Useful MySQL link
bazz is offline   Reply With Quote
Old 03-24-2009, 07:25 PM   PM User | #5
yebaws
New Coder

 
Join Date: Mar 2009
Posts: 10
Thanks: 2
Thanked 0 Times in 0 Posts
yebaws is an unknown quantity at this point
Quote:
Originally Posted by guelphdad View Post
Normalize your data instead.
well, yes, in an ideal world. And I'll do that in the long term. I didn't make the database, so I'm not guilty there. But I need this search up quickly and normalising the data will not be quick. Should have said that to start with, anticipating the responses....
yebaws is offline   Reply With Quote
Old 03-24-2009, 08:25 PM   PM User | #6
guelphdad
Super Moderator


 
guelphdad's Avatar
 
Join Date: Mar 2006
Location: St. Catharines, Ontario Canada
Posts: 2,629
Thanks: 4
Thanked 147 Times in 138 Posts
guelphdad will become famous soon enoughguelphdad will become famous soon enough
use find_in_set
guelphdad is offline   Reply With Quote
Users who have thanked guelphdad for this post:
yebaws (03-24-2009)
Old 03-24-2009, 08:30 PM   PM User | #7
yebaws
New Coder

 
Join Date: Mar 2009
Posts: 10
Thanks: 2
Thanked 0 Times in 0 Posts
yebaws is an unknown quantity at this point
Quote:
Originally Posted by guelphdad View Post
use find_in_set
thank you - that's the one!
yebaws is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:36 PM.


Advertisement
Log in to turn off these ads.