If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Fulltext search problem

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-30-07, 03:36
Oddish Oddish is offline
Registered User
 
Join Date: Mar 2003
Posts: 43
Question Fulltext search problem

I've got a table of companies that I'm trying to search for by name, but it doesn't work like I expected so I'm hoping someone can explain what I'm doing wrong. Here's the query:
Code:
SELECT
    *
FROM
    companies AS com
WHERE
    MATCH (
        com.uc_company_name,
	com.ks_company_name
    ) AGAINST (
        'rör*'
    IN BOOLEAN MODE)
The table has got a fulltext index on the two name columns and when I search for the phrase "rör" like in the query above, I get results like:
  • Röragenten Björn Halvarsson
  • Rörfirma K Å Karlsson AB
  • Bede Rörservice AB
But this company gets left out:
  • H. Holmbergs Rör AB
Why is that?

Thanks in advance!
Reply With Quote
  #2 (permalink)  
Old 05-30-07, 05:06
Oddish Oddish is offline
Registered User
 
Join Date: Mar 2003
Posts: 43
Apparently, the host hadn't changed ft_min_word_len to 3 like I asked several weeks ago. I suspect that's the problem.
Reply With Quote
  #3 (permalink)  
Old 05-30-07, 05:08
aschk aschk is offline
Registered User
 
Join Date: Mar 2007
Location: 636f6d7075746572
Posts: 770
UNION it with a LIKE clause...
Reply With Quote
  #4 (permalink)  
Old 05-30-07, 05:14
aschk aschk is offline
Registered User
 
Join Date: Mar 2007
Location: 636f6d7075746572
Posts: 770
I'm curious to know why you're using fulltext search anyway. A company name is never going to be HUGE and thus you should have a normal index instead of a fulltext one. This alleviates the need for MATCH and instead you can use a LIKE and get all the right results.
Reply With Quote
  #5 (permalink)  
Old 05-30-07, 06:00
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,156
I'm more intrigued as to why
Code:
'rör*'
returns
  • Bede Rörservice AB
__________________
George
Twitter | Blog
Reply With Quote
  #6 (permalink)  
Old 05-30-07, 07:10
aschk aschk is offline
Registered User
 
Join Date: Mar 2007
Location: 636f6d7075746572
Posts: 770
Because it's a fulltext search the * acts on words (i.e. seperated by a space) so any word beginning with 'rör' is matched. 'Rörservice' is one word and fulfils the criteria. If it was 'ARörservice' it would fail...
Reply With Quote
  #7 (permalink)  
Old 05-30-07, 07:17
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,156
*makes a note*
Ohh right!
Thanks mate - I never knew that ^_^
__________________
George
Twitter | Blog
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On