Results returned in an order?

Is it possible to do a search and have the results returned in an order?

I have the following code:

$propiedadesObtenidas = Property::search($request->get('ubicacion'))

            ->where('tipoDePropiedad_id', '=', $tipoPropiedad_id[0])

            ->where('category_id', '=', $categoria_id[0])


I added the following relation:

$array['suscription'] = $this->suscription->map(function ($data) {

            return $data['plan_id'];


It is based on a subscription plan, where a user pays the subscription (consisting of three parts, basic, standard and advanced). I want the search engine to return the advanced plans first, then the standards, and then the basic ones, is there a way to do something like this? I would really appreciate an idea that enlightens me

Hi there,

In general, you can configure sort order of the search result on the index side. More details can be find in this document.

If you want to put it at your query time, I guess you can try filter scoring .
You can add filter parameter using ‘with()’ method as described here.

Hello in Laravel it seems not to work, it always brings me the order as it is in the database. There is no way to orderBy?

I have a field called plan with values ​​3 - 2 -1 - 0 and I want to show the records first on 3, then 2 and so on but I can’t do it, could you please enlighten me a little more. Thanks a lot

Hi marexito2012,

Is it possible to send us a code snippet to see how you are configuring scout?

With Laravel you should be able to use filter scoring as mention here:

As mentioned by Tatsuro, it will be best to configured the order at indexing time by using your dashboard for example as mentioned here.

I was doing the upgrade wrong and did not order because of this inconvenience !! thank you!