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.
-
SmartHub administrators can simply click the UI Editor link from the SmartHub Administration page.
-
Click the Select a page link from the top menu.
-
Select (double-click) an HTML page such as Results.html page.
-
Below, the Results.html page is shown for sample purposes.
-
BA Insight recommends you use page and folder to modify. Leave the default files as templates.
-
Example: Customizations/Results.html. Default Results.html is under the top most SmartHub directory.
-
-
-
Select the Advanced mode from the top right of the page.
-
Select Advanced settings edit.
-
Scroll down to line 148 (this may vary), which contains the text
SH.AnalyticsSettings.CustomSettings
-
To access the available Recommended Results settings, click the See Default Settings link in the top right corner.
-
A new browser tab opens with all available SmartHub module settings.
- Search for the word "recommendedResultsControl" on the page to quickly navigate to the Recommended Results default settings, nested under the AnalyticsSettings component shown below:
- Copy the entire recommendedResultsControl section.
- Go back to your Advanced settings edit tab.
- Paste the copied settings inside section SH.AnalyticsSettings.CustomSettings.
- Modify additional settings as desired.
- Click Save changes.
-
Click the link Preview <html> file.html at the top of the code editor.
-
Review your HTML page in the new tab that opens.
-
Make any necessary changes back in the code editor. Repeat steps 14-18 as necessary.
-
Click Save changes.
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.
How to Disable Recommended Results
From within the settings inside section SH.AnalyticsSettings.CustomSettings.
- By default, the following two parameters are set to false and true, respectively:
showRecommendedResultsDropdown
enableRecommendedResultsControl
- Set both parameters to false to disable this feature.
How to Modify or Filter the Recommended Results Display
Procedure:
-
Follow steps 1-9 under the UI Builder topic, above to access the Recommended Results settings.
-
The Recommended Results items are stored 5 lines under the
recommendedResultsControl: {
line in the settings file:
-
Copy the settings nested under the
items: {
line. - Paste the copied settings inside section SH.AnalyticsSettings.CustomSettings.
- Modify additional settings as desired. Use the tables below in the topic "Recommended Results Display Settings."
- Click Save changes.
-
Click the link Preview <html> file.html at the top of the code editor.
-
Review your HTML page in the new tab that opens.
-
Make any necessary changes back in the code editor. Repeat steps 5-8 as necessary.
-
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. |
|
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.
- Go to Analytics Configuration page.
-
Add a new recommended result, using the format from the below example, in the Recommended Results Configuration Json setting.
For example, if you useID 100:
Analytics config file: Recommended Results blockCopy{
"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%)"
} -
In your custom HTML page settings, add a new item in the
items
array and specify your parameters such as shown below.Note thatValue
settings maps to Option ID.CopyrecommendedResultsControl:{
items:{
“myCustomResults”: {
Value: ”100”,
Lastdays: ”10”,
maxResults: ”10”,
customParam: ”customparamvalue”
}
}
} -
Finally, add Content-by-Search on a page with the Option ID:
Content by SearchCopy<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">