Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

If the customer types in a search word that does not yield any results, you have an opportunity to communicate with them by adding relevant text messages, targeted ads, banners, and widgets using Hawksearch dashboard.

Example use case: Display a custom text message for no results search page.

Step 1: Set up a content item like below with the relevant text message.

Steps to add a Content Item: Content Items

Step 2: Set up a campaign that would define the trigger when the Content item created above should be returned in the response.

Steps to add a Campaign: Campaigns

Step 3: Please confirm that the Content item is being returned in the response for no results page.

Request: POST request to search keyword “abcdefg”:

POST /api/v2/search HTTP/1.1
Host: searchapi-dev.hawksearch.net
Content-Type: application/json
Cache-Control: no-cache
Postman-Token: b1dc5ba6-9262-bc68-c48a-0a344afe5316

{
  "index":"elasticdemo.20210325.082034",
  "ClientGuid": "f12458r1c38446f0bacdf283390c37e8",
  "keyword":"abcdefg"
}

Response: In the search results response structure, there are 2 main keys which include the information about the Content item/Campaign created above:

  • “Output” is the HTML content created in step 1 above which can be rendered on-site end as is.

  • Trigger” indicates the Campaign information and the rule being used to insert the content item in the response.

  "Merchandising": {
        "Items": [
            {
                "Zone": "Top",
                "Title": "No Results",
                "ContentType": "custom",
                "ForwardUrl": "",
                "Output": "<p><span style=\"background-color:#ffff00;\"></span></p><span style=\"font-size:14px;\"> - Please double check your spelling.</span><br style=\"font-size:14px;\" /><span style=\"font-size:14px;\"> - Try searching for an item that is less specific.</span><br style=\"font-size:14px;\" /><span style=\"font-size:14px;\"> - You can always narrow your search results later.</span><span style=\"background-color:#ffff00;\"><br /></span><p><span style=\"background-color:#ffff00;\"></span><span style=\"background-color:#ffff00;\"><br /></span><br /></p>",
                "IsMobile": false,
                "IsTrackingEnabled": false,
                "Target": "",
                "MobileWidth": 0,
                "MobileHeight": 0,
                "Trigger": {
                    "BannerGroupId": 56308,
                    "Name": "No result message ",
                    "SortOrder": 0,
                    "Rule": {
                        "RuleType": 0,
                        "Field": "",
                        "Condition": "",
                        "Value": "",
                        "FieldType": "System.String",
                        "Guid": "b50126cabd7a4d618cfda1c231f00a32",
                        "ShouldEvaluateAfterSearch": false,
                        "Operator": 0,
                        "Rules": [
                            {
                                "RuleType": 1,
                                "Field": "nofresults:nofresults",
                                "Condition": "equals",
                                "Value": "0",
                                "FieldType": "nofresults",
                                "FieldName": "Number of Results",
                                "FieldValue": "0",
                                "Guid": "47e68cd2234b41548636b02b039b1f5f",
                                "ShouldEvaluateAfterSearch": false,
                                "Operator": 2,
                                "Rules": []
                            }
                        ]
                    }
                },
                "BannerId": 73460,
                "CampaignId": 56308
            }
        ]
    }
  • No labels