讨论数量:
@leo $pager = new LengthAwarePaginator($products, $result['hits']['total'], $perPage, $page, [
'path' => route('products.index', false), // 手动构建分页的 url
]);
return view('products.index', [
'products' => $pager,
'category' => isset($category) ? $category : null,//$category ?? null, // 等价于 isset($category) ? $category : null
'filters' => ['search' => $search,'order' => $order,],
]);
结果刷新商品页面 全部查询出来了,页面右下角也没有分页html代码,我输入的搜索关键字,在ES哪里打断点 ,命中目标一条,find_in_set后 查出来的记录是一条,所以es搜索没问题。
下面是断点出分页的返回代码
LengthAwarePaginator {#423 ▼
total: 1
lastPage: 1
items: Collection {#492 ▼
#items: array:68 [▶]
}
perPage: 16
currentPage: 1
path: "http://shopme.com/products?"
query: []
fragment: null
pageName: "page"
},
我只命中了一条,为什么items 是查出来全部68条? 我浏览器请求完整链接是http://shopme.com/products?search=iphonex,为什么分页断点出来的path没有后面的sarch=iphonex了?
推荐文章: