LIKE ? then 150 else 0 end) + (case when LOWER(`topics`.`title`) LIKE ? then 50 else 0 end) + (case when LOWER(`topics`.`title`) LIKE ? then 10 else 0 end) + (case when LOWER(`posts`.`cached_content`) LIKE ? then 150 else 0 end) + (case when LOWER(`posts`.`cached_content`) LIKE ? then 50 else 0 end) + (case when LOWER(`posts`.`cached_content`) LIKE ? then 10 else 0 end)) as relevance from `topics` left join `posts` on `topics`.`id` = `posts`.`topic_id` group by `topics`.`id` having relevance >= 5.00 order by `relevance` desc) as `topics` left join `posts` on `topics`.`id` = `posts`.`topic_id` group by `topics`.`title` ◀»
array:6 [▼
0 => "llc"
1 => "llc%"
2 => "%llc%"
3 => "llc"
4 => "llc%"
5 => "%llc%"
]
»select * from (select `topics`.*, max((case when LOWER(`topics`.`title`) LIKE ? then 150 else 0 end) + (case when LOWER(`topics`.`title`) LIKE ? then 50 else 0 end) + (case when LOWER(`topics`.`title`) LIKE ? then 10 else 0 end) + (case when LOWER(`posts`.`cached_content`) LIKE ? then 150 else 0 end) + (case when LOWER(`posts`.`cached_content`) LIKE ? then 50 else 0 end) + (case when LOWER(`posts`.`cached_content`) LIKE ? then 10 else 0 end)) as relevance from `topics` left join `posts` on `topics`.`id` = `posts`.`topic_id` group by `topics`.`id` having relevance >= 5.00 order by `relevance` desc) as `topics` left join `posts` on `topics`.`id` = `posts`.`topic_id` group by `topics`.`title` limit 10 offset 0 ◀»
array:6 [▼
0 => "llc"
1 => "llc%"
2 => "%llc%"
3 => "llc"
4 => "llc%"
5 => "%llc%"
]
Обсуждают сегодня