Совет: переходите на Laravel
Пример генерации запроса Eloquence Searchable:
SELECT *
FROM
(SELECT `product_products`.*,
max(CASE WHEN `product_products`.`name` = 'достаука'
OR `product_products`.`name` = 'шашлик' THEN 150 ELSE 0 END + CASE WHEN `product_products`.`name` LIKE 'достаука%'
OR `product_products`.`name` LIKE 'шашлик%' THEN 50 ELSE 0 END + CASE WHEN `product_products`.`name` LIKE '%достаука%'
OR `product_products`.`name` LIKE '%шашлик%' THEN 10 ELSE 0 END) AS relevance
FROM `product_products`
WHERE (`product_products`.`name` LIKE '%достаука%'
OR `product_products`.`name` LIKE '%шашлик%')
GROUP BY `product_products`.`id`) AS `product_products`
WHERE `relevance` >= 2.5
ORDER BY `relevance` DESC