Jump to content

Recommended Posts

hi, i wish to use FULLTEXT index in my php website, for searching purpose. but, i'm not quite understand with this FULLTEXT, so can anyone please help me and tell me actually in what situation need to use this type of searching?

 

so that i can decide whether there is a need for me to use it or just use the simple search method.

Link to comment
https://forums.phpfreaks.com/topic/142217-about-fulltext-index/
Share on other sites

FULLTEXT index only works with the MyISAM storage engine. In other words you can not use it on a table that also uses foreign keys.  So if you happen to be using the InnoDB engine you'll need to work something else out for searches.  In many cases this will do.

 

SELECT field WHERE field LIKE  "%value%";

Link to comment
https://forums.phpfreaks.com/topic/142217-about-fulltext-index/#findComment-746654
Share on other sites

FULLTEXT index only works with the MyISAM storage engine. In other words you can not use it on a table that also uses foreign keys.  So if you happen to be using the InnoDB engine you'll need to work something else out for searches.  In many cases this will do.

 

SELECT field WHERE field LIKE  "%value%";

 

this is my problem, my table need to be innodb, but i want to use FULLTEXT index...

 

yup, i have think about your code too, but how about user enter a phrase for search keyword? with the above code, only when the data is exact match the phrase only will be detected. how about if the search phrase is 'happy family', but i want record with either got 'happy' or 'family' to be detected?

Link to comment
https://forums.phpfreaks.com/topic/142217-about-fulltext-index/#findComment-751169
Share on other sites

this is my problem, my table need to be innodb, but i want to use FULLTEXT index...

 

You can't. It's like saying you need transaction support in MyISAM.

 

You might want to take a look an Sphinx as fenway suggested. It supports both MySQL engines

Link to comment
https://forums.phpfreaks.com/topic/142217-about-fulltext-index/#findComment-751239
Share on other sites

for myisam engine, u have to declare the field that need to be fulltext.

then use sql like this to search "happy family". it will returned "happy family","happy", "family"

 

SELECT general.g_page,commonnames, scientificname, general.desc FROM general WHERE ( match (general.scientificname)  against('$search' in boolean mode) ) or ( match (general.commonnames)  against('$search' in boolean mode) ) or ( match (general.desc)  against('$search' in boolean mode) ) GROUP BY general.scientificname

Link to comment
https://forums.phpfreaks.com/topic/142217-about-fulltext-index/#findComment-751491
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.