leony Posted August 22, 2008 Share Posted August 22, 2008 Hi I have a MYSQL query for my searc page. How can I assign more importance to "title" column than "body_text2 column? $sql = "SELECT *, MATCH(title, body_text) AGAINST ('$keyword') AS score FROM my_table WHERE MATCH(title, body_text) AGAINST('$keyword') ORDER BY score"; Quote Link to comment https://forums.phpfreaks.com/topic/120840-mysql-query-for-search-page/ Share on other sites More sharing options...
cooldude832 Posted August 22, 2008 Share Posted August 22, 2008 you can add to the order by clause and add the columns you want first higher. Quote Link to comment https://forums.phpfreaks.com/topic/120840-mysql-query-for-search-page/#findComment-623022 Share on other sites More sharing options...
Maq Posted August 22, 2008 Share Posted August 22, 2008 If you mean you want to score to be the most important than title do this: $sql = "SELECT *, MATCH(title, body_text) AGAINST ('$keyword') AS score FROM my_table WHERE MATCH(title, body_text) AGAINST('$keyword') ORDER BY score, title"; Quote Link to comment https://forums.phpfreaks.com/topic/120840-mysql-query-for-search-page/#findComment-623026 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.