I have a products database, and this is how I'm running a query to show results for the keywords 'chair':
SELECT `products`.product_id, products.product_name
FROM (`products`)
WHERE `product_name` LIKE '%chair%'
AND `products`.`active` = 1
UNION ALL
SELECT `products`.product_id, products.product_name
FROM (`products`)
WHERE `category_id` IN (128,135,136,138)
AND `products`.`active` = 1
I saw on this thread: MySQL order by "best match" how to order by 'best match' given only a %like%
constraint.
How can I implement something similar on my particular query?