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 configuration file can be found in the directory \modules\SmartHubResourceLoader\DefaultModuleSettings.js, around line 15.
The configuration file must be used only as an example and it should not be modified because it will be overwritten at upgrade time.
All the changes to the settings should be done using the custom settings file created for the page. See How to Customize Your SmartHub User Interface.
How to Disable Recommended Results
- 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
The recommended results items are stored in the DefaultModuleSettings.js file:
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 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%)"} -
In your custom settings file add a new item in the
items
array and specify your parameters such as shown below.
Note that "Value
" settings maps to Option ID.CustomSettingsTemplate.js
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 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">