Link additional content to search results

You can obtain and display additional information, that is, non-catalog and non-indexed content, along with the search results. Examples include banner images and links to other pages.

To display additional information, you must take the following steps:
  • Verify Guided Search service definition - Verify that the guided search service definition is located at:
    /gsadmin/v1/cloud/pages/Default/services/guidedsearch
    and ensure that it is configured to get additionalContent information. If not, use HTTP PUT to update the service definition.
  • Configure a rule trigger - Define a content item, or trigger:
    /gsadmin/v1/cloud/content/additionalContent/TriggerName
    This trigger is fired when a shopper does a search for the trigger name, for example, abbreviated form. A business user can make a HTTP POST or PUT request to create or update the rule trigger definition.
  • Make a search from the storefront application using search term aboutus to /ccstore/v1/search and observe the response. You should see a JSON object with key additionalContent.

Verify Guided Search service definition

You use REST endpoints exposed at /gsadmin/v1/cloud/pages/Default/services/guidedsearch to ensure that service is updated to return additional content along with search results.

The following table describes the JSON attributes required to configure the Guided Search service definition.
Attribute Value
additionalContent Key name to be used to retrieve the additional content from the search response.
@type Cartridge type to be passed. This must be set as ContentSlot.
contentPaths Resource path to rule definitions. This should point to the folder containing rules to evaluate the additional content. By default this points to /content/additionalContent.
ruleLimit Number of rules matches will not be more than the value specified here. The rule engine will evaluate all the rules in contentPaths based on the priorities defined.

Example 47-1 Updated Guided Search Service definition

The following JSON illustrates the default guided search service definitions. It can be updated, if required, by using REST endpoints defined for ecr type page.
{
   "ecr:type" : "page",
   "contentItem":
   {
     "@name": "Guided Search Service",
     "@type": "GuidedSearchService",
     "additionalContent":
     {
     "ruleLimit": 1,
     "@type": "ContentSlot",
     "@contentPaths": ["/content/additionalContent"]
     }
   }
}

Configure a rule trigger

You use REST endpoints exposed at /gsadmin/v1/cloud/content/additionalContent/TriggerName to define an additional content item, or a trigger. You can have this trigger either on a search term or on a navigation state, that is, using dimension value IDs.

Example 47-2 Rule trigger definition

You can use the following call to create a new additional content item to trigger on a search for “about us”.
POST /gsadmin/v1/cloud/content/additionalContent/aboutus
          {
           "ecr:type" : "content-item",
           "priority" : 10,
           "contentItem":
            {
               "@type": "UnstructuredContent",
               "title": "Looking for information about our company?",
               "link-title": "About Us",
               "link-url": "/about-us",
               "image": "company-logo.png"
            },
             "triggers":[
            {
               "searchTerms": "about",
               "matchmode": "MATCHEXACT"
            },
               {
               "searchTerms": "about us",
               "matchmode": "MATCHEXACT"
               }
           ]
        }

Verify search responses

After configuring the Guided Search service definition and the rule trigger, when a shopper performs a search or navigates to a specific configured state, it will give back additionalContent information along with search results.