Sorting - Bloomreach Experience - Open Source CMS

Sorting

Example request

Here's an example request with a sort parameter that instructs the response to sort products in ascending order of sale price:

Example request, sorted in ascending order of sale price

GET http://core.dxpapi.com/api/v1/core/?
account_id=<Bloomreach Provided Account ID>
&auth_key=jazzhands
&domain_key=example_com
&request_id=8830241055597
&_br_uid_2=uid=7797686432023:v=11.5:ts=1428617911187:hc=55
&ref_url=http://www.example.com/home
&url=http://www.example.com/index.html?q=dresses
&request_type=search
&rows=20
&start=0
&fl=pid,title,brand,price,sale_price,colors,sizes,thumb_image,price_range,sale_price_range
&q=dresses
&search_type=keyword
&sort=sale_price+asc

Changing the sequence of results

You can alter the sequence in which products are displayed by passing the  sort  parameter. In the following snippet, the  sort  parameter specifies that results are sorted in ascending order of price:

&sort=price+asc

This  sort  value displays products from the lowest price to the highest price, regardless of the relevance each product has to the search query.

Likewise, the following snippet sorts results in descending order of sale price:

&sort=sale_price+desc

And, if you include the information in your feed, ascending order of product launch dates:

&sort=launch_date+asc

Using multiple sort options

You can include one sort parameter and with multiple values in a request. Multiple sort values must be in a comma-separated list. Sorting is applied to the list in reverse sequence. In the following example, results are sorted first in descending order of sale price, then in descending order of reviews. If there is a tie, then preference goes to the final item in the list.

&sort=reviews+desc,sale_price+desc

Multiple sort parameters result in errors. Use just one sort parameter with multiple values for multiple sort options.

Did you find this page helpful?
How could this documentation serve you better?
On this page
    Did you find this page helpful?
    How could this documentation serve you better?