orange08 Posted January 24, 2009 Share Posted January 24, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/142217-about-fulltext-index/ Share on other sites More sharing options...
Chicken Little Posted January 26, 2009 Share Posted January 26, 2009 It should be faster and more efficient. For more info see http://dev.mysql.com/doc/refman/5.1/en/fulltext-search.html Quote Link to comment https://forums.phpfreaks.com/topic/142217-about-fulltext-index/#findComment-746637 Share on other sites More sharing options...
Mchl Posted January 26, 2009 Share Posted January 26, 2009 You would use FULLTEXT index for example to perform searches in content of forum messages. In other words, when you need to search in large blocks of text. Quote Link to comment https://forums.phpfreaks.com/topic/142217-about-fulltext-index/#findComment-746640 Share on other sites More sharing options...
phparray Posted January 26, 2009 Share Posted January 26, 2009 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%"; Quote Link to comment https://forums.phpfreaks.com/topic/142217-about-fulltext-index/#findComment-746654 Share on other sites More sharing options...
fenway Posted January 27, 2009 Share Posted January 27, 2009 Sphinx is much better. Quote Link to comment https://forums.phpfreaks.com/topic/142217-about-fulltext-index/#findComment-747549 Share on other sites More sharing options...
orange08 Posted January 31, 2009 Author Share Posted January 31, 2009 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? Quote Link to comment https://forums.phpfreaks.com/topic/142217-about-fulltext-index/#findComment-751169 Share on other sites More sharing options...
Mchl Posted January 31, 2009 Share Posted January 31, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/142217-about-fulltext-index/#findComment-751239 Share on other sites More sharing options...
FezEvils Posted January 31, 2009 Share Posted January 31, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/142217-about-fulltext-index/#findComment-751491 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.