Configuring AI Search

This article describes the process of enabling the AI search engine on a website. First, the feature is configured, then the configuration is implemented so it can become operational. Learn more about capabilities of the feature here.

Note: AI Search Engine will work after delivering the item catalog, however, providing transactional data will improve the personalization of results.

Terminology explained


  • Index - A data structure created from a catalog of items. The index is used by the search engine to look for results that match a query.
  • Score - It is a value that indicates how relevant a search result is for a given query.
  • Facets - Used in search to let users narrow down search results to items that have common features.

Prerequisites


  1. Paste the tracking code to your website.
  2. Import an item feed to Data Management > Catalogs in the application.
    WARNING: The value of an item attribute in the item feed or a catalog cannot be longer than 1000 characters. It applies both for creating a new index and updating it.

Implementation

The AI search can be implemented by using two endpoints:

  • Autocomplete - When listening to the input, you can use the autocomplete endpoint in our API to send each keystroke of the customer to the search engine and receive autocomplete results as the customer types. The results need to be rendered in real time in the search box.
  • Full-text search - The search is only performed once, when the customer initiates it by clicking the search button or pressing ENTER. The results are usually displayed on a dedicated page.
    Tip: These search endpoints are available as both GET and POST requests. For details, see the API Reference.

The requests can be authorized with the same tracker key as used in the tracking code.

Note: It is possible to inject the search by using Dynamic Content.

Example of a search request:

var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function () {
    if (this.readyState == 4 && this.status == 200) {
        var result = JSON.parse(this.responseText);
        Console.log(result);
    }
};
xhttp.open("GET", "https://ai-api.synerise.com/search/v2/indices/{indexId}/query?query={SEARCH_QUERY}&clientUUID={USER_UUID}&token={TRACKING_KEY}", true);

You must send a item.search.click event. This enables monitoring the search statistics and preparing search analytics.

Note: You can find the documentation here.

{
     "clientUUID": String,
     "searchType": String,
     "correlationId": String,
     "position": Number,
     "item": String
 }

where:

  • clientUUID is the client’s UUID,
  • correlationId must be have the same value as the searchId parameter value. You can source this value from the search response. Thanks to this, you can link a search result with information about which item from that result was clicked.
  • positionis the position of the clicked item.
    IMPORTANT: the first position is 1, not 0,
  • item is the ID of the clicked item,
  • searchType is the type of search conducted: full-text search or autocomplete search.
😕

We are sorry to hear that

Thank you for helping improve out documentation. If you need help or have any questions, please consider contacting support.

😉

Awesome!

Thank you for helping improve out documentation. If you need help or have any questions, please consider contacting support.

Close modal icon Placeholder alt for modal to satisfy link checker