laravel / nova-issues

556 stars 34 forks source link

Laravel Nova Resource Index Query not respecting ordering when scout is enabled #5730

Closed oluomotoso closed 1 year ago

oluomotoso commented 1 year ago

Description:

When Laravel Scout is enabled - the resource index field is not respecting the default sort

Detailed steps to reproduce the issue on a fresh Nova installation:

Install and configure Laravel Nova with Laravel Scout enabled. Create a resource in Laravel Nova with a default sorting defined in the indexQuery method. Observe that the default sorting is not applied to the index results.

crynobone commented 1 year ago

This is the expected behaviour so Scout can utilise the relevant search results instead of just depending on indexQuery(). You should use scoutQuery() and interacts with Laravel\Scout\Builder to change the behaviour.