求解使用 nicolaslopezj/searchable 扩展包在使用 paginate 分页时 sql 的问题?
正常代码:
$articles = Article::search($title)->get()->toArray();
报错代码:
$articles = Article::search($title)->paginate(10)->toArray();
sql会报错,错误提示如下:
SQLSTATE[HY000]: General error: 2031 (SQL: select count(*) as aggregate from (select `articles`.*, max((case when LOWER(`articles`.`title`) LIKE ? then 150 else 0 end) + (case when LOWER(`articles`.`title`) LIKE ? then 50 else 0 end) + (case when LOWER(`articles`.`title`) LIKE ? then 10 else 0 end)) as relevance from `articles` group by `articles`.`id` having relevance > 2.50 order by `relevance` desc) as `articles`)
我测试了半天发现使用get()
时sql语句中要搜索的值是正常的,使用paginate()
时sql语句中要搜索的值是?
.
这个包对mysql版本有要求,你使用的版本是多少
@tanjibo mysql版本是5.7.20的,这个包要求的mysql的最低版本是多少?