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

  1. Select Plugins from the side navigation pane and click on the Extra search sourced from tab - full results link tile.

  2. 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

plugin.extra-search-search-preview.config.*.facet_name

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

plugin.extra-search-search-preview.config.*.category_label

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.

Combine with selected facets

Configuration key

plugin.extra-search-search-preview.config.append_selected_facets

Data type

boolean

Default value

false

Required

This setting is required

Determines if the selected facet categories should be carried across when clicking the more results link.

Examples

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 and example~ds-facebook

  • A tabbed facet called Tabs containing the following categories:

  • Websites which returns documents from example~ds-websites data source.

  • Social media which returns documents from the example~ds-facebook data source.

  • An extra search called social_media which pulls content from the example~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

social_media

Tabs

Facet category to select

social_media

Social media

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.

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 and example~ds-events

  • A tabbed facet called Tabs has been configured containing following categories:

  • Websites which returns documents from example~ds-websites data source.

  • Events which returns documents from the example~ds-events data source.

  • A checkbox facet called Department containing categories sources from department metadata.

  • An extra search called events which pulls content from example~ds-events.

The following parameter keys need to be added to the results page configuration:

Configuration key name Parameter 1 Value

Facet to select

events

Tabs

Facet category to select

events

Events

Combine with selected facets

true

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.

Change log

[1.1.0]

Changed

  • Updated to the latest version plugin framework (Funnelback shared v16.20) to enable integration with the new plugin management dashboard.