mattc_uk Posted March 8, 2011 Share Posted March 8, 2011 Does anyone know a function or way that I can get my php search form to suggest alternatives when zero results are returned? Ideally it would look through the database column that has just been searched and suggest some records that are close to what was typed... is this possible? Quote Link to comment https://forums.phpfreaks.com/topic/230036-how-to-get-a-php-search-form-to-suggest-alternatives-in-mysql-database/ Share on other sites More sharing options...
mattc_uk Posted March 9, 2011 Author Share Posted March 9, 2011 *bump* Quote Link to comment https://forums.phpfreaks.com/topic/230036-how-to-get-a-php-search-form-to-suggest-alternatives-in-mysql-database/#findComment-1184923 Share on other sites More sharing options...
cssfreakie Posted March 9, 2011 Share Posted March 9, 2011 well i think you need some hardcore regular expressions for this and a table with keywords. otherwise I would have no idea how to do this. I think this is pretty difficult. Quote Link to comment https://forums.phpfreaks.com/topic/230036-how-to-get-a-php-search-form-to-suggest-alternatives-in-mysql-database/#findComment-1185209 Share on other sites More sharing options...
n3r0x Posted March 9, 2011 Share Posted March 9, 2011 Might be possible by shortening down the term they where searching for multiple ways and then search with an extensive "OR" list in either keyword table or directly in the text, not that this would probably strain your mysql database a lot (even with great indexing). Quote Link to comment https://forums.phpfreaks.com/topic/230036-how-to-get-a-php-search-form-to-suggest-alternatives-in-mysql-database/#findComment-1185247 Share on other sites More sharing options...
cssfreakie Posted March 10, 2011 Share Posted March 10, 2011 Might be possible by shortening down the term they where searching for multiple ways and then search with an extensive "OR" list in either keyword table or directly in the text, not that this would probably strain your mysql database a lot (even with great indexing). instead of OR you could use REGEX in an sql query too. Quote Link to comment https://forums.phpfreaks.com/topic/230036-how-to-get-a-php-search-form-to-suggest-alternatives-in-mysql-database/#findComment-1185310 Share on other sites More sharing options...
n3r0x Posted March 10, 2011 Share Posted March 10, 2011 Might be possible by shortening down the term they where searching for multiple ways and then search with an extensive "OR" list in either keyword table or directly in the text, not that this would probably strain your mysql database a lot (even with great indexing). instead of OR you could use REGEX in an sql query too. Yes but if im not misstaking regexp search slower, but then again would be a lot of ORs so might be faster with regexp search... Anyway he should test what works best and run with that..=) Quote Link to comment https://forums.phpfreaks.com/topic/230036-how-to-get-a-php-search-form-to-suggest-alternatives-in-mysql-database/#findComment-1185494 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.