Periscope module
Operations Bundled: Framework
Edition | CE |
---|---|
License |
|
Issues |
|
Maven site |
|
Latest |
2.0.1 |
The Periscope module provides back-end functionality used by the Global Search. It can be used out-of-the-box to search all content apps or extended by activating search in external data sources and by implementing operations commonly used by your users.
The Global Search brings the back-end search functionality of the Periscope module into the Magnolia UI. It provides the UI display of the Global Search box, search results list, and filter buttons to refine results.
Module structure
artifactID | Description |
---|---|
|
Provides the default search result supplier and periscope operation configuration files. |
|
Provides an API to plug in search result suppliers to the search result set, as well as to create your own query sniffers (for example, for vocal commands). |
|
Provides speech-to-text recognition capabilities. |
Installing with Maven
Maven is the easiest way to install the module. Add the following to your bundle:
<dependency>
<groupId>info.magnolia.periscope</groupId>
<artifactId>magnolia-periscope-core</artifactId>
<version>2.0.1</version> (1)
</dependency>
1 | Should you need to specify the module version, do it using <version> . |
<dependency>
<groupId>info.magnolia.periscope</groupId>
<artifactId>magnolia-periscope-api</artifactId>
<version>2.0.1</version> (1)
</dependency>
1 | Should you need to specify the module version, do it using <version> . |
<dependency>
<groupId>info.magnolia.periscope</groupId>
<artifactId>magnolia-speech-recognition</artifactId>
<version>2.0.1</version> (1)
</dependency>
1 | Should you need to specify the module version, do it using <version> . |
The functionality of the QuerySniffer and OperationRequest components is now handled by the Global Search system.
The magnolia-speech-recognition code is no longer linked to the new Global Search functionality.
This obsolete code is non-functional and will be removed to streamline the codebase.
|
Configuration
There’s no additional configuration required for standard use because the default configuration provides a number of search result suppliers.
You may configure additional search result suppliers and periscope operations to suit your specific needs.
Search result suppliers
Search result suppliers are responsible for providing results to the Global Search.
Example supplier definition (for the Pages app content):
class: info.magnolia.periscope.search.jcr.JcrSearchResultSupplierDefinition
appName: pages
workspace: website
nodeTypes:
- mgnl:page
fullTextSearch: true
titleProperty: title
icon: icon-webpages-app
For REST integrations
You can define a search result supplier using YAML for integration of external data set through REST. For more details, see the page REST search result suppliers for Periscope.
For JCR workspaces
Content apps are detected when you start Magnolia and the system generates corresponding SearchResultSuppliers
for their JCR workspaces automatically.
You only need to define a search result supplier using YAML to search JCR workspaces if you want to customize the supplier.
Magnolia provides a registry with a specific info.magnolia.periscope.search.jcr.JcrSearchResultSupplierDefinition class that searches over defined JCR workspaces using specific node types and with the option of performing full-text search.
In the example below, the JcrSearchResultSupplierDefinition
class, <my-custom-workspace>
workspace and <my-node-type>
node type are specified.
Full-text search is activated within the workspace defined.
class: info.magnolia.periscope.search.jcr.JcrSearchResultSupplierDefinition
workspace: <my-custom-workspace>
appName: <app-to-open>
nodeTypes:
- <my-node-type>
fullTextSearch: true
titleProperty: caption
JcrSearchResultSupplierDefinition
properties
Property | Description | ||
---|---|---|---|
|
required, default is Fully qualified class name of the supplier definition. Must implement the |
||
|
required Name of the workspace in the |
||
|
optional Name of the app that opens when a search result is clicked. |
||
|
required List of node types you want to search. If no value is specified, the supplier will search all node types. |
||
|
required Title of the searched node. Always searched by default and used as a title for the result. |
||
|
required default is Restricts the search only to match a specific node name. |
||
|
optional, default is Path configured as the root of the workspace. Only content below the path is operated on. |
||
|
optional, default is When |
||
|
optional, default is When |
||
|
optional, default is When |
||
|
optional, default is Limit on the total number of search results that can be retrieved. |
||
|
optional, default is Specifies the timeout duration in seconds for individual search supplier operations. Behavior
|
||
|
optional, default is Strategy used to construct a search result supplier from |
||
|
optional Node containing the order configuration of search results. See the info.magnolia.periscope.search.jcr.JcrSearchResultSupplierOrder class. |
||
|
required Node type property to sort search results by. Use a Magnolia node type or define your own property. |
||
|
required A map where:
|
||
|
optional, default is Name of the subapp that opens when a search result is clicked. |
||
|
optional, default is Name of the detail subapp that opens when a search result is clicked. |
||
|
optional CSS class that identifies an icon used for the supplier. |
||
|
optional Text displayed on the supplier icon. The value is i18n-able. |
Creating a custom search result supplier
If you want to search non-JCR databases or external datasets, you must create your own corresponding SearchResultSupplier
.
Use the info.magnolia.periscope.search.SearchResultSupplierDefinition interface provided by the magnolia-periscope-api
submodule to implement a search result supplier.
public interface SearchResultSupplier {
String getName();
Stream<SearchResult> search(SearchQuery query) throws SearchException;
}
Each SearchResultSupplier
is responsible for supplying results.
The results of suppliers are represented by SearchResult
objects which contain text, metadata and a periscope operation request, which specifies what should be done when a user selects that result.
public class SearchResult {
private final String title;
private final String content;
private final String path;
private final OperationRequest operationRequest;
private final String type;
private final String lastModifiedBy;
private final ZonedDateTime lastModified;
private final Status status;
private final SearchResultItem resultItem;
}
Search results
You can modify the existing search results configuration by the definition decoration mechanism.
For example, the following light module configuration updates the defaultCountPerSupplier
to 3
, allowing you to see only up to three search results.
globalSearchConfiguration:
defaultCountPerSupplier: 3
Configurable properties
The table below lists properties that affect how search results appear.
Property | Description |
---|---|
|
|
|
optional List defining the ordering of search result groups. |
|
optional List of user roles available in the Author search filter. All users are available unless specified otherwise. |
|
optional, default is Integer defining the maximum number of search results shown from any single search supplier. |
Disabling result ranker
The boolean disabled
property of the info.magnolia.periscope.ResultRankerConfiguration
allows you to entirely disable the ranking of Global Search results.
Asynchronicity of search queries
To improve search performance for multiple threads trying to get the same session on the same workspace, you may need to change the limit of the total number of concurrent queries.
Go to the magnolia.properties
file and adjust the magnolia.periscope.result.supplier.thread
system property value.