Push data to Coveo (SAP Commerce Cloud 2205 or later)

This is for:

Developer

This article explains how to push data from an SAP Commerce Cloud (version 2205 or later) to a Coveo organization.

Prerequisites

You’ll need the Coveo Push API client library for Java, so make sure that:

Step 1: Install the Coveo Search provider extension

The Coveo Search Provider SAP Commerce Extension allows your SAP project to exchange data with Coveo. To install the extension, perform the following steps:

  1. Clone or download the extension repository to the hybris/bin/custom directory of your project.

  2. Open the hybris/config/localextensions.xml file and add the searchprovidercoveosearchservices extension:

    <extension name='searchprovidercoveosearchservices' />
  3. Install the Coveo Push API client library for Java:

    1. Open the Apache Maven settings.xml file. The file is usually located either at the ${maven.home}/conf/settings.xml or ${user.home}/.m2/settings.xml.

    2. Add a repository definition for the library’s GitHub Package.

      <repository>
          <id>github</id>
          <url>https://maven.pkg.github.com/coveo/push-api-client.java</url>
          <snapshots>
              <enabled>true</enabled>
          </snapshots>
      </repository>
    3. Specify your GitHub personal access token (classic) to be able to install packages from GitHub Packages.

      Important

      The token should have at least read:packages permission.

      <servers>
      <server>
          <id>github</id>
          <username>USERNAME</username>
          <password>TOKEN</password>
      </server>
      </servers>
  4. From the root of your project directory, run the following command:

    ant clean all
  5. After the command execution, navigate to the hybris/bin/platform directory.

  6. Run the hybrisserver.sh script:

    ./hybrisserver.sh

    By default, your local server would use ports 9001 (http) and 9002 (https).

  7. Open the Hybris Administration console at https://localhost:9002/platform/update

  8. Find and select the checkboxes for the searchprovidercoveosearchservices extension to create the new search provider.

  9. At the top of the page, click the Update button.

Step 2: Create a source in your Coveo organization

For storing the SAP catalog data, we recommend using a Catalog source. See Add or edit a Catalog source.

Step 3: Create an API key

Create an API key with the privileges shown in this article: Create a Catalog source. See the Edit sources, edit source update schedules, and view the View Metadata page row in the privileges table.

For additional information on API keys, see Manage API keys and Manage privileges.

Step 4: Create a consumed destination

  1. In your Coveo organization, open the Catalog source you created in step 2.

  2. On the Configuration tab, there’s a section called Stream API URL. Click the Copy to clipborad button to copy the URL.

  3. In the SAP Backoffice Administration Cockpit, go to the SystemAPIDestinationsConsumed Destinations page.

    Note

    By default, the local Administration Cockpit is available at https://localhost:9002/backoffice/.

  4. Click the plus sign.

  5. In the modal window that appears:

    • ID. Enter a unique ID for a new destination. For example, CoveoDestination.

    • URL. Paste the URL you copied from the Catalog source.

    • Active. Verify that the Active checkbox is selected.

    • Destination Target. Click the field and select any destination target.

      Note

      The destination target you select doesn’t matter as it’s not used in the push implementation and only needed to create the destination.

  6. Click the Finish button.

    The properties of a new consumed destination

Now you see the destination you created in the list of consumed destinations.

Step 5: Create a credential for the consumed destination

  1. Click the destination you created and switch to the Destination Configuration tab.

  2. Double-click in the Credential field to open a dropdown menu and select Create CredentialConsumed OAuth Credential.

  3. Fill in the following fields:

    • ID. Enter a unique ID for a new credential. For example, CoveoCredential.

    • Client ID. Enter a client ID for a new credential. For example, CoveoClientID.

  4. Click the Finish button. You see the Destination Configuration tab again.

  5. Double-click in the Credential field to open the credential settings.

  6. In the Client Secret section, there are Password and Verify password fields. Paste the API key you created in step 3 in both fields.

  7. Click the Save button to save and close the credential settings.

  8. Click the Save button to save the destination settings.

The properties of a Coveo credential with the password filled in

Step 6: Create a search provider

  1. In the Administration Cockpit, go to the SystemSearch and NavigationSearch Provider Configurations page.

  2. Next to the plus sign, click the dropdown menu and select Coveo Search Provider Configuration.

  3. Fill in the following fields:

    • Identifier. Enter a unique identifier for a new search provider, for example, Coveo.

    • Name. Enter a name for a new search provider, for example, CoveoSearchProvider.

  4. Click the Finish button. Now you see the provider you created in the list of search providers.

  5. Click the provider you created and switch to the Administration tab.

  6. Scroll to the Unbound section and click the Consumed Destinations field. Select the destination you created in step 4.

  7. Click the Save button to save the provider settings.

Step 7: Update the index configuration

  1. Navigate to the SystemSearch and NavigationIndex Configurations page.

  2. In the list of configurations, double-click the configuration corresponding to the site you’re adding the Coveo search to.

  3. On the General tab, click the Search Provider Configuration field and select the provider you created in step 6.

  4. Click the Save button to save the configuration settings.

Step 8: Map the catalog fields

To make sure that SAP Commerce Cloud is able to send the catalog data to Coveo, you need to map the catalog fields to the Coveo fields.

  1. Navigate to the SystemSearch and NavigationIndex Types page.

  2. In the list of index types, double-click the index type corresponding to the site you’re adding the Coveo search to.

  3. Switch to the Fields tab.

  4. Examine the Identifier column. Use the values in this column to map the catalog fields to the Coveo fields.

Example

For the SAP field name, you need to create the mapping %[name] in a Coveo source.

The properties of an index type showing the available fields ←→ An example of mapping within a Coveo Catalog source

Step 9: Run the index

  1. Navigate to the SystemSearch and NavigationIndex Types page.

  2. In the list of index types, double-click the index type corresponding to the site you’re adding Coveo search to.

  3. Switch to the Cron Jobs tab.

  4. Double-click the required cronjob.

  5. Make sure that the cronjob is enabled, see the True checkbox in the Enabled section.

  6. Click the Save button to save and close the cronjob settings.

  7. While having the index type open, click the Run indexer button.

  8. In the modal window that appears, click the dropdown menu and select the cronjob that you’ve just enabled.

  9. Click the Run button.

You can track the indexing progress by clicking the Processes button at the top of the Administration Cockpit.