[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 785
  • Last Modified:

MySQL Full Text Search questions

I have a simple table in database called  devtop with sample rows like:

id          keyphrase                                                  score
34        popular nursing schools                               q2
35        career paths in psychology                          q7

where id is the primary key.

(1)
I want to make keyphrase column as Full Text Search index type.  I could not find in the MySQL Admin GUI application how to do that.  Can you provide SQL for that ? I was able to convert from InnoDb to MyISAM which is required for Full Text Search indexing.

(2)
It says Full Text Search will ignore words shorter than 4 characters by default. But I need to search based on 3 characters words also.  How to change this default?

(3)
 Supposed I need to search for 'nurse'  ( returning rows that has the keyword nurse in the column keyphrase.  Will this return row number 34? I mean is it smart enough to know that 'nursing' also matches 'nurse'.  

(4)
What about matching synonyms? Will search for keyword ' famous'  return row 34?  As famous is synonym for popular.

Question number 5 is optional but would appreciate if you have Hibernate experience.
(5)  What is the Hibernate HQL query to search for keyword 'nurse' in the column 'keyphrase' based on Full Text Search. In Raw SQL for MYSQL I will use  Match Against construct in the SQL. What is the Hibernate HQL or Hibernate Criteria query equivalent for this?
0
zenguru
Asked:
zenguru
1 Solution
 
Roger BaklundCommented:
1) alter  table TableName add fulltext index (keyphrase);

2) In mysql config file (my.ini) in mysqld section, add this and then restart the server:

ft_min_word_len=3

NB: Do this before you create the the fulltext index, or you must rebuild the index after this change is implemented.

3) No

4) No

5) I don't know

MySQL documentation can be found here:

http://dev.mysql.com/doc/refman/5.1/en/fulltext-search.html
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now