Crystallize logo
More in Learn

Order Search Results

There are times when you would like to order search results based on a particular field and in a particular direction. This section takes a look at how you can achieve that.

In order to perform these operations, ensure that you have the proper authentication (if necessary) and user permissions.

Order by Name

To order the search results depending on the item name, you can provide the following values to the orderBy argument. Feel free to change the direction value to DESC in the playground below to change the direction as well.

Circle loading spinnerImage of a partial circle indicating &qoute;loading&qoute;.Fetching snippet...

Order by Price

To order the search results using the price of the item, you can set the field to PRICE. The query below orders the items starting from the lowest price to the highest price.

Circle loading spinnerImage of a partial circle indicating &qoute;loading&qoute;.Fetching snippet...

Order by Stock

Lastly, you can order the search depending upon the amount of stock each item has. The example query below orders the items starting from the item that has the highest stock to the item that has the lowest stock.

Circle loading spinnerImage of a partial circle indicating &qoute;loading&qoute;.Fetching snippet...
People showing thumbs up

Need further help?

Join and ask our
slack community.

Join our slack community