Breadcrumbs

Offer search - Meta data

Metadata at field level guide the client for the usage of the parameters and the availability of the data:

Attribute

Type

Description

canSort

boolean

Some fields can be sorted: the client is able to use sortBy and sortDirection parameter.

canFacet

boolean

Some fields can have facets: the client is able to use facets parameters.

canFilter

boolean

Some fields can be filtered: the client is able to use filters parameters depending on the distribution.

distribution

{'discrete','continuous'}

Some fields have continuous distribution (price, resolution, size...) then use filterGreaterThan and filterLowerThan parameters. Some fields have discrete distribution (color, merchantId...) then use filterBy parameter.

filterKey

string

All fields, whether they can be filtered or not, have a filterKey which can be used to refer to this field when building filters. Its use is described in the documentation on facets

isOptional

boolean

Some fields are optional. If fields are requested but optional, secure your code: the field will be there but might have a null value.

statisticsAvailable

boolean

On continuous distribution field, min and max are available in the metadata. On discrete distribution field, distinctValuesCount and distinctValuesCountInResult are available in the metadata.

  • Metadata at field level on fields with a continuous distribution according to the result:

Attribute

Type

Description

min

float

Minimum value of the field in all offers matching the filters (not only the result).

from

float

Minimum value of the field in offers in the result.

to

float

Maximum value of the field in offers in the result.

max

float

Maximum value of the field in all offers matching the filters (not only the result).

Note: min <= from <= to <= max

  • Metadata at field level on fields with a discrete distribution according to the result:

Attribute

Type

Description

distinctValuesCount

int

Given field distinct values count in all offers matching the filters (not only the result).

distinctValuesCountInResult

int

Given field distinct values count in all offers in the result.

Note: distinctValuesCountInResult <= distinctValuesCount

All fields metadata

Check the offer model which is based on the metadata

Examples

Meta data on continuous distribution fields without statistics

  • Given  the input parameters are

name

value

query

nike air max 98

fieldsMeta

rebateEndDate

  • When  the client perform a GET on /api/public/search/offers with the input parameters

  • And  the json response contains meta/fields with the following content

JSON
{
  "fields": {
    "rebateEndDate": {
      "distribution": "continuous",
      "canSort": false,
      "canFacet": false,
      "canFilter": false,
      "filterKey": "rebateEndDate",
      "isOptional": true,
      "statisticsAvailable": false
    }
  }
}

Meta data on continuous distribution fields with statistics

  • Given  the input parameters are

name

value

fieldsMeta

totalPrice,price

  • When  the client perform a GET on /api/public/search/offers with the input parameters

  • Then  I get a response with status 200

  • And  the json response contains meta/fields with the following content

JSON
{
  "fields": {
    "totalPrice": {
      "distribution": "continuous",
      "canSort": true,
      "canFacet": true,
      "canFilter": true,
      "filterKey": "totalPrice",
      "isOptional": false,
      "isFilterValidated": true,
      "statisticsAvailable": true,
      "from": 250,
      "to": 300,
      "min": 100,
      "max": 400.5
    },
    "price": {
      "distribution": "continuous",
      "canSort": true,
      "canFacet": true,
      "canFilter": true,
      "filterKey": "price",
      "isOptional": false,
      "isFilterValidated": true,
      "statisticsAvailable": true,
      "from": 200,
      "to": 250,
      "min": 100,
      "max": 420.99
    }
  }
}

Meta data on a discrete distribution field without statistics

  • Given  the input parameters are

name

value

fieldsMeta

offerId

  • When  the client perform a GET on /api/public/search/offers with the input parameters

  • Then  I get a response with status 200

  • And  the json response contains meta/fields with the following content

JSON
{
  "fields": {
    "offerId": {
      "distribution": "discrete",
      "canSort": false,
      "canFacet": false,
      "canFilter": true,
      "filterKey": "offerId",
      "isOptional": false,
      "isFilterValidated": true,
      "statisticsAvailable": false
    }
  }
}

Meta data on a discrete distribution field with statistics

  • Given  the input parameters are

name

value

fieldsMeta

merchantId

  • When  the client perform a GET on /api/public/search/offers with the input parameters

  • Then  I get a response with status 200

  • And  the json response contains meta/fields with the following content

JSON
{
  "fields": {
    "merchantId": {
      "distribution": "discrete",
      "canSort": false,
      "canFacet": true,
      "canFilter": true,
      "filterKey": "merchantId",
      "isOptional": false,
      "isFilterValidated": true,
      "statisticsAvailable": true,
      "distinctValuesCount": 80,
      "distinctValuesCountInResult": 3
    }
  }
}