Specify Recommended Results

 

What are Recommended Results?

  • Recommended results enable you to filter your search results according to the parameters that you specify.
  • Shown in the user interface in the 'Filter results by" in the top right corner of the Results page. (See the graphic below)
  • These parameters can include:
    • Recently viewed
    • Most used by me
    • What others are viewing
    • New results
    • Curated results

How to Configure your Recommended Results

  • The Recommended Results component is embedded in the Analytics Settings module

  • Modify your HTML page's settings to enable the Recommended Results component for the page

  • This is done using the UI Builder tool

UI Builder

  • The easiest and fastest way to insert and customize Recommended Results is via the SmartHub UI Builder.

  • For more information, see How to Use the UI Builder.

Procedure:

  1. SmartHub administrators can simply click the UI Editor link from the SmartHub Administration page.

  2. Click the Select a page link from the top menu.

  3. Select (double-click) an HTML page such as Results.html page.

    1. Below, the Results.html page is shown for sample purposes.

    2. BA Insight recommends you use page and folder to modify. Leave the default files as templates.

      1. Example: Customizations/Results.html. Default Results.html is under the top most SmartHub directory.

      2. See Creating Custom Pages.

  4. Select the Advanced mode from the top right of the page.

  5. Select Advanced settings edit.

  6. Scroll down to line 148 (this may vary), which contains the text SH.AnalyticsSettings.CustomSettings


  7. To access the available Recommended Results settings, click the See Default Settings link in the top right corner.

  8. A new browser tab opens with all available SmartHub module settings.

  9. Search for the word "recommendedResultsControl" on the page to quickly navigate to the Recommended Results default settings, nested under the AnalyticsSettings component shown below:
  10. Copy
        SH.AnalyticsSettings = SH.AnalyticsSettings || {};
        SH.AnalyticsSettings.DefaultSettings = {
            Enabled: true,
            PAXModules: "PAX_PortalModule,PAX_SearchModule,PAX_UserProfileModule,PAX_VisualRefinersModule,PAX_SmartPreviewsModule,PAX_Ratings,PAX_ChatBotModule,PAX_SmartAutomationsModule",
            customProperties: "",
            showTrackingBehaviorControl: true,
            enableGeolocationTracking: true,
            artifactPushInterval: 60, //seconds
            visitsDuration: 30, //minutes
            geolocationTrackingMessage: "We would like to know your location in order to improve your search experience.".toLocaleString(),
            trackingBehaviorPropertyName: "BAISmartHubAnalyticsTrackingBehavior",
            defaultTrackingBehavior: "0", // 0 - Track; 1 - Do not track; 2 - Track but hide identity
            trackingControlFile: "client/pax-tracking-behavior-control", // must have the format used by require.js
            recommendedResultsControl: {
                showRecommendedResultsDropdown: false,
                enableRecommendedResultsControl: true,
                title: "Filter results by".toLocaleString(),
                messageNotFoundRecommededResults: "Could not find any results for option: ".toLocaleString(),
                items: {
                    "Default": {
                        value: "0",
                        label: "Default".toLocaleString()
                    },
                    "RecentlyViewed": {
                        value: "1",
                        label: "Recently viewed".toLocaleString(),
                        lastDays: "5",
                        maxResults: "100"
                    },
                    "MostUsedByMe": {
                        value: "2",
                        label: "Most used by me".toLocaleString(),
                        lastDays: "5",
                        maxResults: "100"
                    },
                    "WhatOthersAreViewing": {
                        value: "3",
                        label: "What others are viewing".toLocaleString(),
                        lastDays: "5",
                        maxResults: "100"
                    },
                    "NewResults": {
                        value: "4",
                        label: "New results".toLocaleString(),
                        lastDays: "5",
                        maxResults: "100"
                    },
                    "CuratedResults": {
                        value: "5",
                        label: "Curated results".toLocaleString(),
                        lastDays: "5",
                        maxResults: "100",
                        "SmartAnalyticsIndex.[AccountName]": "AdditionalProperty.[AccountName]"
                    }
                },
                parentSelector: ".coveo-results-header" // JQuery selector for parent element(s) where to inject the control.
  11. Copy the entire recommendedResultsControl section.
  12. Go back to your Advanced settings edit tab.

  13. Paste the copied settings inside section SH.AnalyticsSettings.CustomSettings.
  14. Modify additional settings as desired.
  15. Click Save changes.
  16. Click the link Preview <html> file.html at the top of the code editor.

  17. Review your HTML page in the new tab that opens.

  18. Make any necessary changes back in the code editor. Repeat steps 14-18 as necessary.

  19. Click Save changes.

How to Disable Recommended Results

From within the settings inside section SH.AnalyticsSettings.CustomSettings.

  1. By default, the following two parameters are set to false and true, respectively:
    1. showRecommendedResultsDropdown
    2. enableRecommendedResultsControl


  2. Set both parameters to false to disable this feature.

How to Modify or Filter the Recommended Results Display

Procedure:

  1. Follow steps 1-9 under the UI Builder topic, above to access the Recommended Results settings.

  2. The Recommended Results items are stored 5 lines under the recommendedResultsControl: { line in the settings file:

  1. Copy the settings nested under the items: { line.

  2. Paste the copied settings inside section SH.AnalyticsSettings.CustomSettings.
  3. Modify additional settings as desired. Use the tables below in the topic "Recommended Results Display Settings."
  4. Click Save changes.
  5. Click the link Preview <html> file.html at the top of the code editor.

  6. Review your HTML page in the new tab that opens.

  7. Make any necessary changes back in the code editor. Repeat steps 5-8 as necessary.

  8. Click Save changes.

 

Recommended Results Display Settings

Use the following options to modify, or add a filter to, the Recommended Results display:

Option (Value: number used for the “Filter results” drop-down) Description
Recently viewed (value: "1") Displays the results (Max Results) opened in the lastDays.
Most used by me (value: "2") Displays the top (Max Results) results opened by me in the lastDays.
What others are viewing (value: "3") Displays the top (Max Results) results opened by other users in the lastDays.
New results (value: "4") Displays the top (Max Results) results opened by other users in the lastDay and the documents that have been modified in the last week.
Curated results (value: "5") Displays the top (Max Results) results opened by users in the same department

Parameters

Use the following parameters:

Parameter Description
value This the OptionId from the Recommended Results Configuration JSON.

label

This is the display name of the filter.
lastDays This determines how recent the results are.
maxResults This is the maximum number of results.

How to Add a New Filter

To add a new filter, add a new item in the items array and specify your parameters.

See the following example:

{ value: "value_example", label: "title_example", lastDays: "lastDays_example", maxResults: "maxResults_example" },

Custom Recommended Results

If you need a custom recommended results on your page, use the following procedure.

  1. Go to Analytics Configuration page.

         
  2. Add a new recommended result, using the format from the below example, in the Recommended Results Configuration Json setting.

    For example, if you use ID 100:

    Analytics config file: Recommended Results block
    Copy
    {
    "OptionId": "100",
    "QueryTemplate": {
        <your custom query to Elastic goes here, it can use lastDays and any other custom parameter as needed> },
    "QueryTransformation": "(%ORIGINALQUERY%) AND (%RECOMMENDEDITEMS%)"
    }
  3. In your custom HTML page settings, add a new item in the items array and specify your parameters such as shown below.

    Note that Value settings maps to Option ID.
    Copy
    recommendedResultsControl:{
        items:{
            “myCustomResults”: {
                Value: ”100”,
                Lastdays: ”10”,
                maxResults: ”10”,
                customParam: ”customparamvalue”
             }
        }
    }
  4. Finally, add Content-by-Search on a page with the Option ID:

    Content by Search
    Copy
    <div class="CoveoContentBySearch" 
    data-query-text="{SA.RecommendedResults.100}" 
    data-source-id="b29924a9-ec32-4c10-8892-a544b69ee121" 
    data-results-per-page='5' data-hide-until-first-query="false">