deepakfugo Posted March 21, 2013 Share Posted March 21, 2013 Hi All, I am uisng PHP & Mysql DB for my site and i have a task for suggesting Categories based on User keyword input.I have written the query as below but i need to ignore white spaces of the values of columns while matching, how can we achieve it SELECT search.*, MATCH (name) AGAINST ('black' IN BOOLEAN MODE) AS name_match, MATCH (keywords) AGAINST ('black' IN BOOLEAN MODE) AS keyword_match, MATCH (description) AGAINST ('black' IN BOOLEAN MODE) AS description_match FROM search WHERE MATCH (name, keywords, description) AGAINST ('black' IN BOOLEAN MODE) ORDER BY (name_match * 3 + keyword_match * 2 + description_match) DESC LIMIT 0,100; I tried using replace() which were throwing error SELECT search.*, MATCH (replace(`name`,' ','')) AGAINST ('black' IN BOOLEAN MODE) AS name_match, MATCH (replace(`keywords`,' ','')) AGAINST ('black' IN BOOLEAN MODE) AS keyword_match, MATCH (replace(`description`,' ','')) AGAINST ('black' IN BOOLEAN MODE) AS description_match FROM search WHERE MATCH (name, keywords, description) AGAINST ('black' IN BOOLEAN MODE) ORDER BY (name_match * 3 + keyword_match * 2 + description_match) DESC LIMIT 0,100; Link to comment https://forums.phpfreaks.com/topic/275962-ignore-white-space/ Share on other sites More sharing options...
robert_gsfame Posted March 21, 2013 Share Posted March 21, 2013 Have you tried TRIM() ?? Link to comment https://forums.phpfreaks.com/topic/275962-ignore-white-space/#findComment-1420097 Share on other sites More sharing options...
deepakfugo Posted March 21, 2013 Author Share Posted March 21, 2013 yes tried trim() also, not working Link to comment https://forums.phpfreaks.com/topic/275962-ignore-white-space/#findComment-1420109 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.