Results Sorting

Enable results refinement

<<glossary:results>> are sorted in descending order of the scores by default. Allow shoppers to refine the sorting logic per page according to a named field. For example, you can sort by price to look for the cheapest options first.

  • Only one sort_by field is allowed in each request.
  • When sorting logic is applied, it is highly possible that less similar results of the same page will be ranked in front.
  • When group_by is applied, the sorting is applied per group.
Name Type Description

sort_by

String

The product metadata field used to sort the results per page. Ascending :asc or descending :desc order needs to be specified after the field name.



> example response


``` JSON
{
  "status": "OK",
  "method": "product/search_by_image",
  "reqid": "1116464216832753388",
  "error": [],
  "page": 1,
  "limit": 2,
  "total": 1000,
  "result": [
    {
      "product_id": "3024",
      "main_image_url": "http://xx.com/test.jpg",
      "data": {
        "price": {
          "currency": "SGD",
          "value": "500"
        }
      },
      "score": 0.5
    },
    {
      "product_id": "OL13071",
      "main_image_url": "http://xx.com/test.jpg",
      "data": {
        "price": {
          "currency": "SGD",
          "value": "120"
        }
      },
      "score": 0.9
    }
  ]
}