Closed
Description
- Scout Version: 9.3.4
- Scout Driver: MeiliSearch
- Laravel Version: 8.61
- PHP Version: 8.0.14
- Database Driver & Version: Mysql 8
Description:
MeiliSearch supports sorting feature out of the box after defining sortable parameters while indexing. The given orderBy
method is supposed to work for sorting. Consider the following code.
return User::search('Admin')
->orderBy("id", "desc")
->get();
The above code should generate a query like in https://github.com/laravel/scout/blob/9.x/src/Engines/MeiliSearchEngine.php#L114
public function paginate(Builder $builder, $perPage, $page)
{
return $this->performSearch($builder, array_filter([
'filters' => $this->filters($builder),
'limit' => (int) $perPage,
'sort'=> ['id:desc'],
'offset' => ($page - 1) * $perPage,
]));
}
But the sort
options is missing while performing the search.
scout/src/Engines/MeiliSearchEngine.php
Lines 114 to 121 in 7811f6d
scout/src/Engines/MeiliSearchEngine.php
Lines 99 to 105 in 7811f6d