michael-mammut
michael-mammut

Reputation: 2783

How can I order by random in Laravel Meilisearch and Scout

I have a query that fetches data using Meilisearch. However, ordering with orderBy(' RAND() ') does not work and returns the following error message.

"message": "Attribute RAND() is not sortable. Available sortable attributes are: created_at, updated_at.",

I've tried to add 'RAND()' as a sortable attribute, but it does not work. Instead, it keeps the default order by. Is there a way to order the result of Meilisearch with RAND()?

Upvotes: 0

Views: 172

Answers (0)

Related Questions