REST search result suppliers for Global Search
Search result suppliers are responsible for providing search results to the Global Search search result list through the Periscope, its back-end. Below, we describe how you can configure and use search result suppliers that integrate search results of external content through REST.
|
This feature is only available in the DX Core edition of Magnolia. For information about the Magnolia supplier that searches over defined JCR workspaces or about creating a custom search result supplier, see Periscope module: Search result suppliers. |
Configuration properties
The REST-based supplier functionality for the Periscope module is provided by the magnolia-rest-client-ui module as a combination of the following specific Magnolia classes:
-
info.magnolia.rest.ui.periscope.RestClientResultSupplierDefinition
-
info.magnolia.rest.ui.periscope.SearchResultExpressionDefinition
A REST-based search result supplier can be created as a YAML file and configured using the following properties:
| Property | Description |
|---|---|
|
required
|
|
required Name of a configured REST client to fetch search data with. |
|
required Name of a configured REST call definition in the client. |
|
required List of JSON path expressions to get data for each item to be shown in the Global Search results list. Provided by the |
|
required Expression to get the title of the item, for example:
|
|
required Expression to get the URL address of the item, for example:
|
|
optional Expression to show the detail of the item. |
|
optional Expression to get the editor name of the item. |
|
optional Expression to get the last-modified date of the item. YAML files with configuration of search result suppliers should be stored in the
|
Sample REST integration
The following configuration files illustrate how you can deliver search results from outside of Magnolia. When enabled, the supplier definition integrates the GitHub API: Search issues and pull requests.
class: info.magnolia.rest.ui.periscope.RestClientResultSupplierDefinition
restClient: github
restCall: searchGithubIssues
searchResultExpression:
title: $.items[*].title
url: $.items[*].html_url
content: $.items[*].body
date: $.items[*].updated_at
enabled: true
baseUrl: https://api.github.com
restCalls:
searchGithubIssues:
method: get
entityClass: com.fasterxml.jackson.databind.JsonNode
path: /search/issues
queryParameters:
q: "{query}"
If you then query GitHub’s issues, the search result area of the Global Search displays the results.