Bloomreach Discovery

Introduction

Bloomreach provides a Bloomreach Discovery connector with the GraphQL Commerce API. It's enabled by default and has a number of specific configuration options in addition to the general options.

How to request configuration changes?

Please use our support channel to request configuration changes, including properties name and value(s).

Configuration Options

The following configuration options are available for the Bloomreach Discovery connector. If you wish to make a change, please submit a support request with the names of the properties and your preferred values.

Property Name (* required field)DescriptionExample Value(s)
BRSM_API *The Bloomreach Discovery Core API production instance URL.https://core.dxpapi.com/api
BRSM_API_STAGING *The Bloomreach Discovery Core API staging instance URL.https://staging-core.dxpapi.com/api
BRSM_PATHWAYS_APIThe Bloomreach Discovery Recommendations and Pathways API v2 production instance URL.http://pathways.dxpapi.com/api
BRSM_PATHWAYS_API_STAGINGThe Bloomreach Discovery Recommendations and Pathways API v2 staging instance URL.http://pathways-staging.dxpapi.com/api
BRSM_SUGGESTION_API *The Bloomreach Discovery Suggestion API production instance URL.https://suggest.dxpapi.com/api
BRSM_SUGGESTION_API_STAGING *The Bloomreach Discovery Suggestion API staging instance URL.https://staging-suggest.dxpapi.com/api
BRSM_ACCOUNT_ID *The account ID associated with your domain.'6370'
BRSM_DOMAIN_KEY *The domain key value of your Bloomreach Discovery.'pacific_supply'
BRSM_AUTH_KEY *The authorization key associated with your account'1vjobidilg5gcbpn'
BRSM_CUSTOM_ATTR_FIELDSIf a list of field names is specified as a comma separated string, then extra custom fields are extracted from the product item in the JSON response and included in the the GraphQL response like the following example:

{
  "data": {
    "findItemsByKeyword": {
  //...
      "items": [
  {
  //...
"customAttrs": [
{ "name": "brand", "values": [ "Michelin" ] },
{ "name": "score", "values": [ "0.014996755" ] }
]
  },
  //...
  ]
  }
  }
}
'brand,score'
BRSM_CUSTOM_VARIANT_ATTR_FIELDSIf a list of field names is specified as a comma separated string, then extra custom fields are extracted from the product variant item in the JSON response and included in the the GraphQL response like the following example:

{
  "data": {
    "findItemById": {
  //...
      "variants": [
  {
  //...
"customAttrs": [
{ "name": "color_code", "values": [ "78T" ] }
]
  },
  //...
  ]
  }
  }
}
'color_code'
BRSM_CUSTOM_VARIANT_LIST_PRICE_FIELDIf specified, the custom property of the product variant item in the JSON response will be used as the listPrice of the product variant. If not specified or not resolved by this configuration, the listPrice of the product variant item will have no money amount data.

NOTE: if this custom field name is project-specific one, please include this custom field name in the BRSM_CUSTOM_ATTR_FIELDS environment variable, too, to make the custom field included in the JSON responses from Bloomreach Discovery.

In the following example, if this is set to 'sku_price', then the "sku_price" property (1.09 in the example) of the specific variant item will be used as the listPrice.

{
"response":{
//...
"docs":[
{
//...
"variants":[
{
"sku_price":1.09,
"sku\_price\_attr":[
"0.89"
],
//...
},
]
}
]
}
}
'sku_price'
BRSM_CUSTOM_VARIANT_PURCHASE_PRICE_FIELDIf specified, the custom property of the product variant item in the JSON response will be used as the purchasePrice of the product variant. If not specified or not resolved by this configuration, the listPrice of the product variant item will have no money amount data.

NOTE: if this custom field name is project-specific one, please include this custom field name in the BRSM_CUSTOM_ATTR_FIELDS environment variable, too, to make the custom field included in the JSON responses from Bloomreach Discovery.

In the following example, if this is set to 'sku\_price\_attr', then the first item (0.89 in the example) of the "sku\_price\_attr" array property of the specific variant item will be used as the purchasePrice.

{
"response":{
//...
"docs":[
{
//...
"variants":[
{
"sku_price":1.09,
"sku\_price\_attr":[
"0.89"
],
//...
},
]
}
]
}
}
'sku_price_attr'
BRSM_RESPONSE_TIME_HEADER_ENABLEDIf set to 'true', the internal response time in milliseconds measured in the Bloomreach Discovery backend is read by the GraphQL Commerce API and passed in the X-BR-Response-Time response header.

👍

Tip:

The API client data can be retrieved from your Bloomreach Discovery instance, more specifically on https://tools.bloomreach.com/, under the Configuration tab.

Discovery-specific data

The Bloomreach Discovery connector supports additional query fields to retrieve Discovery-specific data.
Below you can find two examples, the first as part of the facet results while the second as part of the query hint.

query FindItemsByKeyword($text: String!, $offset: Int!, $limit: Int!) { 
    findItemsByKeyword(text: $text, offset: $offset, limit: $limit) { 
      ...
      facetResult {
        ...
        ranges {
          name
          id
          values {
            start
            end
            count
          }
        }
      }
      ...
      queryHint {
        ...
        autoCorrectQuery
        autoCorrectQuerySet
        redirectHint {
          url
          query
          newQuery
        }
        statsFields {
          price {
            max
            min
          }
        }
      }
      ...
  }
}

Additionally, while retrieving Discovery categories, parent categories can also be included. Please note that this operation can be a little bit expensive: please use it only if needed.

query ($id: String!, $queryHint: QueryHintInput) {
    findCategoryById(id: $id, queryHint: $queryHint) {
      id
      parentId
      displayName
      path
      parent{
        id
        displayName
        path
        parentId
      }
    }
}