Magnolia 6.1 reached end of life on March 31, 2021. This branch is no longer supported, see End-of-life policy.
The Periscope Result Ranker module uses neural networks to store Find Bar search results and rank them by relevance. It extends the Periscope modules.
The module learns user preferences to offer better result ranking for subsequent searches. By default, search result rankings are stored per user. You can change the configuration as necessary. For example, you can enable an individual ranking for each user or for selected users only. Additionally, you can configure the memory size of networks to mitigate possible memory consumption issues in large setups.
Since Magnolia 6.1.5,
info.magnolia.periscope.ResultRankerConfiguration allows you to entirely disable the ranking of Find Bar search results. To do so, set
true in the
resultRankerConfiguration: disabled: false
You may want to disable this configuration to reduce memory usage or resolve potential compatibility issues with DL4J libraries.
Maven is the easiest way to install the module. Add the following dependency to your webapp. All other necessary dependencies will be added automatically.
The module comes with the following default configuration:
outputUnits: 10000 rankingNetworkStorageStrategy: class: info.magnolia.periscope.rank.ml.jcr.JcrUsernameNetworkStorageStrategy
required, default is
The memory size of neural networks.
The result-ranking system requires memory (heap space) and disk space per unit for each user (local ranking) or instance (global ranking). You can adjust the size of the memory used per unit to mitigate possible memory consumption issues (see Result Ranker memory size).
The result-ranking memory strategy.
The default strategy stores result rankings per user. Other strategies are possible (see Result Ranker strategy).
To adjust the strategy, set the
required, default is
Other possible values must be a subtype of
The Periscope Result Ranker module creates a certain number of memory units. The total number of memory units depends on the Result Ranker strategy. The size of a single memory unit is based on the Result Ranker memory size.
You can set the Result Ranker strategy via the
class property of the
This default configuration enables result ranking for each user operating on the author instance. With this strategy, the module creates one neural network for each user. The memory footprint grows with every new user working on an author instance.
With this strategy, only users with the role
ranker have local (per-user) ranking memory. Any other users work with the global (per-instance) ranking memory.
To keep the memory footprint for the Result Ranker on a minimum level, use the
JcrUserRoleNetworkStorageStrategy class and do not assign the role
ranker. Make sure that you have only a few users with the
You can develop your own custom result-ranking strategy. To do this, create a custom class that implements RankingNetworkStorageStrategy and set the
class property in the configuration accordingly.
You can globally configure the memory size of neural networks. To do so, adjust the
outputUnits value. The default memory size is
10000; this value represents the maximum number of Find Bar search results that can be stored and ranked in networks.
Large networks can store more results but use up more memory, while small networks consume less memory but might lose stored results to free up additional memory. Results are removed from networks based on a least-recently-used policy. This ensures that frequent results remain in memory irrespective of when they were added to the networks. You may want to configure the memory size of networks depending on the Result Ranker strategy.
When you change the
outputUnits value (e.g. from
1000), you need to clean up the JCR
rankings workspace. Otherwise, an error will appear when you select a search result. This is because the networks loaded into memory were created using a configuration that no longer exists, rendering any stored results obsolete. When you change the
outputUnits value, make sure that you delete any stored networks and log into the Magnolia instance again to regenerate networks using the new configuration (see Clearing Result Ranker memory).
The Periscope Result Ranker module configuration resides in
periscope-result-ranker/src/main/resources/periscope-result-ranker/config.yaml. The module is deployed as a JAR file, but you can change the configuration by one of the following means:
The configuration is read by the Resources module. Magnolia scans the following for a resource (in this particular order):
The Java bean representation of the selected resource is then stored in the registry. The object in the registry may get decorated if a decorator exists for that configuration.
Storing configuration in the JCR
resources workspace is useful for hotfixes and patches. This way, an administrator can create an urgent fix and publish it in the Resource Files app. In the long run, we recommend using file-based decoration.
The configuration data is read on startup and after it has been changed. The actual data is stored in the module's configuration registry. You can look it up using the Definitions app in modules > periscope-result-ranker.
If you change the
outputUnits value, you must delete all existing network data (see Clearing Result Ranker memory).
With decoration, you can adapt the currently used configuration (whether it is from a light module, hotfix or JAR file). To learn more about decoration, see Definition decoration concept.
A decorator file can reside in any Magnolia Maven module or any light module (see Definition decorator file location). In the example below, we will create a decorator file in a light module named
Within the light module, create the file
outputUnits: 1000 rankingNetworkStorageStrategy: class: info.magnolia.periscope.rank.ml.jcr.JcrUserRoleNetworkStorageStrategy
The Periscope Result Ranker module stores all user-based, role-based, and custom rankings in the JCR
rankings workspace. The module creates one node for each memory unit.
Nodes for local (per-user) rankings are named after user names. Nodes for global (per-instance) rankings are named
To clear the Result Ranker memory:
The Periscope Result Ranker module supports the 64-bit versions of Linux, Mac OS and Windows by default. If you use Magnolia in one of the environments below, you must add the corresponding dependencies manually.
<dependency> <groupId>org.bytedeco.javacpp-presets</groupId> <artifactId>openblas</artifactId> <classifier>linux-armhf</classifier> </dependency>
<dependency> <groupId>org.bytedeco.javacpp-presets</groupId> <artifactId>openblas</artifactId> <classifier>linux-ppc64le</classifier> </dependency> <dependency> <groupId>org.nd4j</groupId> <artifactId>nd4j-native</artifactId> <classifier>linux-ppc64le</classifier> </dependency>