brX Discovery Connector Configuration

Introduction

As explained in Configure brX GraphQL Service, the .env file contains the connection settings to integrate with brX Discovery.

Configuration Options

The following options are supported:

Property Name (* required field)DescriptionExample Value(s)
BRSM_API *The URL of the Bloomreach Search & Merchandising Core API.'https://core.dxpapi.com/api'
BRSM_SUGGESTION_API *The URL of the Bloomreach Search & Merchandising Suggestion API.'https://suggest.dxpapi.com/api'
BRSM_ACCOUNT_ID *The account ID associated to your domain.'6370'
BRSM_DOMAIN_KEY *The domain key value of your Bloomreach Search & Merchandising cloud instance.'pacific_supply'
BRSM_AUTH_KEY *The authorization key associated to 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 Search & Merchandising.

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 Search & Merchandising.

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 Search & Merchandising backend is read by the brX GraphQL Service and passed in the X-BR-Response-Time response header.

👍

Tip:

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

Discovery-specific data

The brX Discovery connector supports additional query fields, in order 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
      }
    }
}