Integrations / Salesforce Commerce Cloud B2C

After you have synchronized your data to Algolia, you can configure your search for optimal relevancy.

You can do this in the Algolia dashboard, on the details page of your indices. In the Algolia dashboard, you should see your newly created indices, which follow the following naming pattern:

  • ${hostname}__${site-id}__products__${locale}
  • ${hostname}__${site-id}__categories__${locale}
  • ${hostname}__${site-id}__contents__${locale} (optional)

The total number of indices created depends on the number of locales your site supports.

Total amount of the Algolia Cartridge

Configure your searchable attributes

When setting up and configuring your index, the first step is to decide which attributes you want to use for searching. Add them by going to Configuration > Searchable attributes. For more information see Searchable attributes.

To begin with, you may consider adding the following attributes: name, short_description, and long_description.

Configure your searchable attributes

Configure your facets

First, define the attributes you want to be available as facets in the Configuration > Facets tab on the Algolia dashboard. We recommend to add at least the following attributes:

  • The price attribute related to each currency your site supports. For example, if your site is using USD and EUR, add price.USD and price.EUR.
  • __primary_category.0, __primary_category.1, __primary_category.2
  • Facets relevant to your products, such as brand, size, color, etc.

The actual facets depend on your attribute names and your record model. For example, if you choose the product-level record model, some facets would become variants.price.USD, variants.size, variants.color.

Total amount of the Algolia Cartridge

Different category levels are represented by the corresponding __primary_category attributes. These attributes are suitable for hierarchical faceting in Algolia, such as Women > Dresses > Evening Dresses: __primary_category.0, __primary_category.1, and __primary_category.2.

Configure results grouping

For large catalogs, common practice is to group results by product to display one result per base product. To do that:

Configure your replicas

You can use replicas to let your users sort search results in different ways, such as sorting by price in ascending and descending order. To create the replicas for sorting on price:

  1. Select your products index and go to Replicas.
  2. Create 2 replicas:

    • hostname__site-id__products__price_USD_asc
    • hostname__site-id__products__price_USD_desc

    Creating Replicas

    This adds two new indices to your app.

    Replicas created

  3. Configure each replica to sort by price.

    Replicas configuration

You can add as many replicas as you need, depending on the number of locales your site supports or other sorting strategies you want to offer. Just make sure your usage of Algolia falls within the limits of your plan.

The Salesforce B2C cartridge also enables content indexing, and all indices are accessible at ${hostname}__${site-id}__contents__${locale}. You have the flexibility to determine how to display this on your storefront.

Did you find this page helpful?