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, supplementing the system with transactional data will facilitate the personalization of results.

Terminology explained


  • Index - It’s a data structure based on the input of the selected catalog a search engine refers to while looking for relevant results in response to a specific query.
  • Score - It is a value that indicates how revelant 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.

Configuration


  1. Go to AI Search icon AI Search > Indexes.

  2. To select the data structure a search engine refers to while searching, click Add index.
    Result: A pop-up appears.

    Click for video tutorial

    1. In the Index name field, type the human-readable name of the index.
    2. From the Catalog dropdown list, select an item catalog the search engine refers to.
    3. Optionally, to let other users know about the purpose of the index, in the Description text field, add the description of the index.
    4. Confirm by clicking Save.
      Result: A new index appears on the list of indexes.
  3. To configure the settings of the index, click its name on the list.

    A blank search engine configuration
    Search engine settings before configuration

  4. Further configuration requires adjusing the settings in the Ranking, Synonyms and Settings sections.

  5. In the Ranking section, define the settings related to hierarchy of the search results.

    Click for video tutorial

    1. By using sliders, on the scale from 0 to 100, define how much each of the three indicators (past page visits, past transactions and personalization) affect the search score.
    2. In the Searchable attributes sub-section, define the level of attribute importance that is considered when scoring an item. To do so, in one of three sections, click Add attribute. From the dropdown list, select the attribute of the item and confirm with the Save button. EXPLANATION: Items in the item catalog have attributes (for example, title, description, price, and so on). When a user enters a query in the search, the engine looks through the index created on the basis of the item catalog. It looks for the word used in the query among the item attributes. It might find the word in more than one attribute of a given item, or in two different attributes in two separate items. By defining searchable attributes, you narrow down the set of attributes that the search will look into. In the next part of the searching process, the search engine considers the importance of the attribute.
      EXAMPLE: Computer is the searched query and you have two items in your item catalog. The first one is a computer which has the title attribute value defined as “gaming computer”. The other is a keyboard and has the description attribute defined as “This keyboard is compatible with any computer”. When no importance is specified, both items are equally valid as a result of the search. However, if you set the title attribute to have higher importance than the description attribute, then the computer will appear before the keyboard in the results because it has higher scoring.
    3. In the Disable prefix search, to switch on the option of searching exact matches of the query and the attribute values, click Add attribute and select the attribute from the list.
      Note: This setting influences the amount of search results. For example, if you disable prefix search on the item IDs, the search will not return a result until a full ID is matched.
  6. In the Synonyms section, determine the substitutes for words and phrases.

    Click for video tutorial

    Tip: Typos are handled by default and do not require synonym configuration
    1. If you want to add synonyms manually, click Add synonym.

      1. Define the type of the synonym.
        One way synonyms work only in one direction. For example, if “telephone” is the base word and its synonyms are “smartphone” and “phablet”, searching for “telephone” also shows the results for “smartphone” and “phablet”.
        Two way synonyms work in two directions, for example if “telephone” is the base word and its synonyms are “smartphone” and “phablet”, searching for “smartphone” or “phablet” also shows the results for “telephone”.
      2. For one way synonyms, in the Word field, enter a basic word.
      3. For one way synonyms, in the Synonym field, enter one or more synonyms seperated by commas.
      4. For two way synonyms, in the Synonyms field enter words related to each other, separated by commas.
      5. Confirm with Save.
    2. If you want to import a CSV file with synonyms click Add synonym > Import CSV.

      1. Choose the method:
        Replace - The file replaces old synonyms with those contained in the file.
        Add - You can add new synonyms to the list of existing synonyms.
      2. Upload a CSV file.
      • Exemplary file:
                word, synonyms, type
                lpatop, laptop, oneway
                "computer, laptop, PC", synonyms
                
      Tip: You can manage typos and serch query replacement through query rules as well.
  7. In the Settings > Language section, select the language that corresponds with the language used in the product feed.

  8. In the Settings > Integrations section, you can define which attributes affect the search results.

Click for video tutorial

  • To filter the search results by specific attributes, in the Filterable attributes click Add attribute and select attributes from the list.
Explanation and examples

Explanation

Adding attributes to the filterable attributes allows to filter the search engine reasults by those attributes. Filtering can be based on including or excluding items with a given attribute value.

Including a value of an attribute narrows down the search results to items with the matching value of that attribute. Excluding values of an attribute displays results with items that have different values of these attributes.

Important: Implementing the search filters is described in the Implementation section in this article.

Examples

Example 1: Products in your catalog have the sale attribute which can take the true (on sale) or false value. Include the text type as a filerable attribute. Now you can filter the results by the items’ sale status.

Example 2: Products in your catalog have the last_item attribute that can take the yes(one item is available) or no (more than 1 item is on stock) values. Exclude the text type as a filterable attribute. Now you can filter the items that have one item left from the search results.

Example 3: You want to filter out the products that cost more than $100. Add price to the range type filterable attributes and in the implementation filter to items where price is equal to or greater than 100$. Include the range type attribute.

  • To aggregate the search results into group of attributes, in the Facetable attributes section, click Add attribute and select attributes from the list.
Explanation and examples

Explanation

Facets count how many items with a given attribute are returned in the search results. The value for each facet is returned in the search response. Facetable attributes are automatically both filterable and sortable.

Example

You want to give a user a possibility to filter results by some attributes - color and brand.

Add these attributes to the Facetable attributes section. When this is done, you will receive information about the number of items in each facet in the search response. This information can be displayed along with the search results and based on that filtering can be applied to the results.

  • To enable the search engine to sort the results by the chosen attributes, in the Sortable attributes section, click Add attribute and select attributes from the list.
Explanation

Explanation

You can add both range and text attributes. Sorting by range attributes allows you to arrange the returned items from highest to lowest value of the specified attribute. Sorting by text attributes allows you to order the results in an alphabetic order, ascending or descending.

  • To define the attributes included in the search response, in the Response attributes section, click Add attribute and select attributes from the list.
Explanation

Explanation

This section defines which attributes will be included in the search response. For each item returned, only attributes defined in this section will be available in the search response. In this place, you add attributes that you would like to show in the search results when rendering items.

Note: Confirmation of the setting adjustments in the Settings section is not needed.
  • If you are setting up the AI search for the first time, implement it in your website.

Implementation


  1. Paste the tracking code to your website.
  2. Import an item catalog to Catalogs in the application.
  3. To authorize your requests, use the search endpoints given in our API documentation.
    1. Get your trackerKey (available in Settings icon Settings > Tracking codes)
    2. Open the used tracking code and copy the trackerKey.
    3. Define the input for the search queries.
    4. Listen to the input.
    • 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. The results need to be rendered in the search box.
    • Full-text search - You must listen to the input (either enter key or a button sending a search query). When pressed, the query must be retrieved from the URL and passed to the full-text search endpoint. In the response you will receive the search results. You need to render a page with the items from the response.
Note: It is possible to use the search through Dynamic Content. The general idea is the same, however there must be a dedicated container for the results. When writing the “Search APP” in Dynamic Content, you have dedicated windows for HTML, CSS and JS.

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 search.click event. This enables monitoring the search statistics and preparing search analytics. You need to send a POST request to https://ai-api.snrbox.com/tracker/v1/single/product.search.click and the request should contain:

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

where:

  • clientUUID is the client’s UUID, which is the value of ‘SyneriseTC.uuid’,
  • correlationId is returned with the search results,
  • positionis the position of the clicked item. IMPORTANT: the first position is 1, not 0,
  • productId 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.