Plugin: Extra search sourced from tab - full results link
Purpose
Use this plugin when you are displaying an extra search that shows a few results from another tab, and you wish to provide a link with the extra search that allows you to view all the results.
This plugin is only designed to be used with extra searches that return top results from another tab.
Details
Extra searches provide the ability to show additional or related content for your search, such as social media or events by allowing additional searches by to run in parallel to retrieve the related content.
For example, extra searches can be used to show a carousel of 3 to 5 related social media results alongside the main search results.
Unfortunately, a limitation of extra searches is that there is no way for the user to see results beyond what is displayed. i.e. Extra searches do not provide navigation links which means that the user is unable to see more matching content from the same extra search.
This plugin addresses this limitation by generating navigation links based on facets (which can be configured via parameter keys) which are added to the data model so that it can more easily templated. The link is generated to the response.extraSearches.<EXTRA-SEARCH-NAME>.customData.stencils.searchPreviewLink
element of the extra search:
{
"question": {},
"response": {},
"extraSearches": {
<EXTRA-SEARCH-NAME>: {
"customData": {
"stencils": {
"searchPreviewLink": "<SEARCH-LINK>"
}
}
}
}
}
The FreeMarker snippet below can be used to present the link generated by the plugin:
<#--
Show the more link which will allow the user to navigate
to the corresponding tab or facet.
-->
<#if (response.customData.stencils.searchPreviewLink)!?has_content && (response.resultPacket.results)!?has_content>
<#assign searchLink = question.getCurrentProfileConfig().get("ui.modern.search_link")!>
<#assign previewLink = response.customData.stencils.searchPreviewLink!>
<a href="${searchLink}${previewLink}" title="See more results">
See more
</a>
</#if>
You are not limited to using Freemarker with this plugin - you can access the generated data model element from your own custom templating. |
Usage
Enable the plugin
-
Select Plugins from the side navigation pane and click on the Extra search sourced from tab - full results link tile.
-
From the Location section, select the results page to which you would like to enable this plugin from the Select a results page select list.
The plugin will take effect as soon as you finish running through the plugin setup steps. |
Configuration settings
The configuration settings section is where you do most of the configuration for your plugin. The settings enable you to control how the plugin behaves.
The configuration key names below are only used if you are configuring this plugin manually. The configuration keys are set in the results page configuration to configure the plugin. When setting the keys manually you need to type in (or copy and paste) the key name and value. |
Facet to select
Configuration key |
|
Data type |
string |
Required |
This setting is required |
Defines the name of the facet which contains the category which is to be selected when clicking the more results link. e.g. Tabs, Format, Department. Parameter 1 should be set to the extra search name and the value should be set to the facet name.
Facet category to select
Configuration key |
|
Data type |
string |
Required |
This setting is required |
Defines the label of the facet category which is to be selected when clicking the more results link. e.g. All results, PDF, Department of Science. Parameter 1 should be set to the extra search name and the value to the category label.
Examples
Add a more results link to an extra search containing Facebook posts which directs the user to the social media tab
In this example, we want to display a link for a social media extra search which navigates the user to the social media tab.
The search is configured with:
-
A search package (called
example~sp-search
) containing two data sources -example~ds-websites
andexample~ds-facebook
-
A tabbed facet called Tabs containing the following categories:
-
Websites
which returns documents fromexample~ds-websites
data source. -
Social media
which returns documents from theexample~ds-facebook
data source. -
An extra search called
social_media
which pulls content from theexample~ds-facebook
data source.
The following parameter keys need to be added to the results page configuration:
Configuration key name | Parameter 1 | Value |
---|---|---|
Facet to select |
|
|
Facet category to select |
|
|
This will produce the following data model element: extraSearches.social_media.response.customData.stencils.searchPreviewLink
.
{
"question": {},
"response": {},
"extraSearches": {
"social_media": {
"customData": {
"stencils": {
"searchPreviewLink": "?query=CURRENT-QUERY&collection=example%7Esp-search&f.Tabs%7Cclient%7Efacebook=Social+media"
}
}
}
}
}
This link can then be accessed from the search result template to give the user an option to view the complete set of extra search results.
Add a more results link to an events extra search which directs the user to the events tab while maintaining facet selection
In this example, we want to create navigate links for an events extra search which provides the ability for the user to navigate to the 'Events' tab. All facet selections are to be carried over.
The search is configured with:
-
A search package (called
example~sp-search
) containing data sources;example~ds-websites
andexample~ds-events
-
A tabbed facet called Tabs has been configured containing following categories:
-
Websites
which returns documents fromexample~ds-websites
data source. -
Events
which returns documents from theexample~ds-events
data source. -
A checkbox facet called
Department
containing categories sources from department metadata. -
An extra search called
events
which pulls content fromexample~ds-events
.
The following parameter keys need to be added to the results page configuration:
Configuration key name | Parameter 1 | Value |
---|---|---|
Facet to select |
|
|
Facet category to select |
|
|
Combine with selected facets |
|
If a user runs a search and selects the department of science category from the department facet this will generate the following link to the data model extraSearches.events.response.customData
:
{
"question": {},
"response": {},
"extraSearches": {
"events": {
"customData": {
"stencils": {
"searchPreviewLink": "?query=<query>&collection=client%7Esp-search&f.Tabs%7Cclient%7Efacebook=Events&f.Department%7Cdepartment=department+of+science"
}
}
}
}
}
The department of science facet selection is included in the generated link so that the facet will be applied automatically when the link is clicked.