Configuring search in Magnolia
By default, Magnolia’s search functionality is provided by the Jackrabbit repository which uses the default Lucene algorithm to calculate the score for ranking results.
For more advanced search options and especially if you need to manage high volumes of assets, you can set up Magnolia to use Solr search. |
Jackrabbit allows you to control which properties of a node are indexed and how much they will affect the jcr:score
value which represents the full-search score of the node serving as a measure of that node’s relevance to the full-text search expression result. Once those properties are defined in the index configuration file, Lucene calculates how to index the content of a workspace.
Lucene
Magnolia’s search works using the Lucene algorithm where by default all properties mentioned in the index-rule receive a boost value of 1.0
.
- For example
-
//*[jcr:contains(.,'apache')] order by @jcr:score descending
jcr:score |
Text property |
---|---|
1000 |
"Apache Jackrabbit" |
848 |
"some test jackrabbit apache, apache is great" |
350 |
"this is a text that is much larger than the first one and only contains the word apache once." |
While all workspaces have the mgnl:tags
property indexed, not all of them have the same configuration:
-
Pages : the title properties receive a boost of 3.0. The components and areas node contents are also included in the
mgnl:page
when the search index is evaluated. -
DAM: the
mgnl:resource
node content is included in themgnl:asset
when the search index is evaluated. -
Tasks: the
mgnl:contentNode
content is included in themgnl:task
when the search index is evaluated.
Configuring Find Bar search results
You can configure how many search results are displayed. To do so, use the definition decoration mechanism.
For example, the following light module configuration updates the defaultCountPerSupplier
to 3
, allowing you to see only up to 3 search results.
findBar:
defaultCountPerSupplier: 3
Configurable properties for Find Bar search
The table below lists properties in the Admincentral module that affect how search results appear.
Property | Description | ||
---|---|---|---|
|
optional, default is Integer defining the maximum number of search results shown from any single search supplier. |
||
|
optional List of user roles allowed in the Last editor search filter: All users are available unless specified otherwise.
|
||
|
optional, default is Configure the minimum number of necessary characters that are shown in a text hint in the find bar to help the user understand how to use the search feature. |
||
|
optional List of search result suppliers. If undefined, it defaults to all suppliers provided by the Periscope module. See also Search result suppliers. |
||
|
optional, default is List defining the ordering of search result groups. |
Configuring in-app search filters
To configure existing search filters or add new ones in apps:
-
Go to the Resource Files app.
-
Find the filter configuration. For example:
-
pages-app.yaml
for the author, status, and template filters in the Pages app. -
pages-content-tags-integration/decorations/pages-app/apps/pages-app.subApps.browser.yaml
for the tag filter in the Pages app. -
dam.subApps.yaml
for the asset type, author, size, and status filters in the Assets app. -
content-tags-integration/decorations/dam-assets-app/apps/dam.subApps.yaml
for the tag filter in the Assets app.
-
-
Look for
workbench
and modify the configuration of the existing filters or add a new filter.All the filters are configured in a similar way. The example below shows the default properties used in the configuration of the asset type filter.
resources/dam-app-jcr/decorations/dam-assets-app/apps/dam.subApps.yaml
workbench: sortFilterOptions: true filters: - name: mimeType icon: icon-file filterOperator: STARTS_WITH $type: dropdownMultiselect propertyName: jcr:content@jcr:mimeType datasource: $type: optionListDatasource options: - name: audio value: audio/ label: Audio - name: documents value: application/,text/ label: Documents - name: images value: image/ label: Images - name: videos value: video/ label: Videos
Other properties are available depending on the filter. See the examples below.
Configurable properties for in-app search
The table below lists workbench
properties that affect how in-app search results appear.
Property | Description |
---|---|
|
optional, default is Sorts the filters by their labels from A-Z. It gets the order from the definition mapping. |
|
optional default is Enables the full-text search field. |
|
optional, default is Placeholder text for the full-text-search field. |
|
optional Configured filter fields. If no filters are defined, only the search field appears. The properties depend on the type of filter, see the following rows in this table. |
|
required The name for the filter. |
|
optional CSS class that identifies an icon used for the filter. See How to add SVG icons for apps. |
|
required Use a valid field alias name to reference a field type. |
|
optional Choose an info.magnolia.ui.filter.FilterOperator for comparing values. Possible values are:
|
|
optional, default is When If there are more than 8 items in the filter, |
|
optional The property name. If no |
|
required Use a valid datasource name to reference a data source type. |
Assets app filters
The following default filters and filter values are provided in the Assets app:
-
Asset type
-
Audio
-
Documents
-
Images
-
Videos
-
-
Author
-
List of users
-
-
Size
-
Small
-
Medium
-
Large
-
Extra large
-
-
Status
-
Draft
-
Marked for deletion
-
Modified
-
Published
-
-
Tag
-
List of all content tags
-
Asset type filter
The asset type filter groups different file formats into filter values. By default, the following filter values are provided:
-
Audio - Uses the MIME type prefix
audio/
. All supported audio formats, such as .mpeg, .webm, .mp4, .ogg, .aac, .aacp, .flac, .wav, .x-wav, or .mp3. -
Documents - Uses the MIME type prefixes
application/
ortext/
All supported document formats, such as .pdf, or .html. -
Images - Uses the MIME type prefix
image/
. All supported image formats, such as .jpeg, .png, .svg, .gif, or .webp. -
Videos - Uses the MIME type prefix
video/
. All supported video formats, such as .mp4, .mpeg, or .webm.
For a list of supported file formats, see Supported file formats for preview generation.
For more information about how MIME types are mapped to file extensions in Magnolia, see MIME type mapping.
resources/dam-app-jcr/decorations/dam-assets-app/apps/dam.subApps.yaml
workbench:
sortFilterOptions: true
filters:
- name: mimeType
icon: icon-file
filterOperator: STARTS_WITH
$type: dropdownMultiselect
propertyName: jcr:content@jcr:mimeType
datasource:
$type: optionListDatasource
options:
- name: audio
value: audio/
label: Audio
- name: documents
value: application/,text/
label: Documents
- name: images
value: image/
label: Images
- name: videos
value: video/
label: Videos
Author filter
The author filter lists all the JCR-based Users in the instance.
SSO-based users may only find their own content using the Current user option that appears in the author filter. |
resources/dam-app-jcr/decorations/dam-assets-app/apps/dam.subApps.yaml
workbench:
filters:
- name: mgnl:createdBy
icon: icon-user-public
filterOperator: EQUALS
$type: dropdownMultiselect
datasource:
name: available-filtering-users
Size filter
The size filter groups different asset sizes into filter values. By default, the following filter values are provided:
-
Small - less than 1 MB:
(,1)
-
Medium - 1 to 5 MB:
[1,5]
-
Large - 5 to 20 MB:
[5,20]
-
Extra large - greater than 20 MB:
(20,)
Configuring size filter ranges
You can configure the size filter values to suit the kind of assets you deal with. For example, small means something different depending on if your asset library contains RTF assets or videos.
To set a range of values for the media size filter values, you must use the supported BETWEEN
filter operator formatting:
[a,b]
(a,b)
[a,b)
(a,b]
-
[
means>=
(more than or equal to). -
]
means⇐
(less than or equal to). -
(
means>
(more than). -
)
means<
(less than). -
The comma (the separator) between the values must exist.
-
a
orb
can be omitted but not both. -
If
a
is omitted, the open symbol can be either[
or(
. -
If
b
is omitted, the close symbol can be either]
or)
.
In the example below, you can see the default configuration for the Size filter.
resources/dam-app-jcr/decorations/dam-assets-app/apps/dam.subApps.yaml
workbench:
filters:
- name: size
icon: icon-zoom-to-fit
filterOperator: BETWEEN
$type: dropdownMultiselect
propertyName: jcr:content@size
datasource:
$type: optionListDatasource
options:
- name: small
value: "(,1048576)"
label: Small (< 1 MB)
- name: medium
value: "[1048576,5242880]"
label: Medium (1 - 5 MB)
- name: large
value: "[5242880,20971520]"
label: Large (5 - 20 MB)
- name: extraLarge
value: "(20971520,)"
label: Extra large (> 20 MB)
Status filter
The status filter lists all the publication statuses.
Status | Description |
---|---|
Published |
Content is published from the author instance to the public instance. Identical content exists on both instances. |
Modified |
Content was modified since publication. The author instance isn’t in sync with the public. |
Draft |
Content exists only on the author instance. |
Marked for deletion |
Content is marked for deletion but still appears in the list (grayed out). It can be restored or permanently deleted. |
resources/dam-app-jcr/decorations/dam-assets-app/apps/dam.subApps.yaml
workbench:
filters:
- name: jcrPublishingStatus
icon: icon-spinner-full
$type: dropdownMultiselect
datasource:
$type: enumDatasource
enumeration: info.magnolia.ui.contentapp.configuration.column.StatusColumnDefinition$PublicationStatus
sorted: true
Tag filter
The tag filter lists all the content tags.
The tag filter is configured in resources/content-tags-integration/decorations/dam-assets-app/apps/dam.subApps.yaml by default, contrary to the other Assets app filters. The configuration is added by decoration to the current implementation of the dam module and is bundled in the content-tags module.
|
resources/content-tags-integration/decorations/dam-assets-app/apps/dam.subApps.yaml
workbench:
filters:
- name: mgnl:tags
icon: icon-tag
$type: dropdownMultiselect
datasource:
name: available-filtering-content-tags
Pages app filters
The following default filters and filter values are provided in the Pages app:
-
Author
-
List of users
-
-
Status
-
Draft
-
Marked for deletion
-
Modified
-
Published
-
-
Tag
-
List of all the content tags
-
-
Template
-
List of all the page templates
-
The author and status filters are configured in the same way as their counterparts in the Assets app.
Only the location of the configuration file is different resources/pages-app/apps/pages-app.yaml
.
The tag filter is also configured in the same way, but in another location: resources/pages-content-tags-integration/decorations/pages-app/apps/pages-app.subApps.browser.yaml
.
Template filter
The template filter lists all the page templates.
resources/pages-app/apps/pages-app.yaml
workbench:
filters:
- name: mgnl:template
icon: icon-view
$type: dropdownMultiselect
datasource:
name: available-filtering-page-templates
Configuring the number of filter results displayed
You can configure how many results are displayed when a user applies a filter in an app.
By default, the results displayed are capped at 200
.
You can increase this value to suit your users' needs or decrease it to improve performance.
To do so:
-
Go to the Resource Files app.
-
Find the configuration of the app (for example,
pages-app.yaml
for Pages ordam.subApps.yaml
for Assets). -
Under
datasource
, add the propertyfilterResultsLimit
. -
Set a value that suits your requirements.
pages-app/apps/pages-app.yamldatasource: $type: jcrDatasource workspace: website filterResultsLimit: 42 (1) allowedNodeTypes: - mgnl:page
1 Only 42
results are displayed in the Pages app when a filter is applied. -
Save your changes.
Authors can see the number of results returned by the filter at the bottom of the app page. If more results are available, the text displayed indicates that.
Disabling in-app search filters and the search field
To disable search filters:
-
Go to the Resource Files app.
-
Find the filter configuration. For example:
-
pages-app.yaml
for the author, status, and template filters in the Pages app. -
pages-content-tags-integration/decorations/pages-app/apps/pages-app.subApps.browser.yaml
for the tag filter in the Pages app. -
dam.subApps.yaml
for the asset type, author, size, and status filters in the Assets app. -
content-tags-integration/decorations/dam-assets-app/apps/dam.subApps.yaml
for the tag filter in the Assets app.
-
-
Look for
workbench
and remove the configuration of the existing filters underfilters
.The filters are removed from the app, but the search field remains.
To remove the search field:
-
Find the filter configuration in your app. For example,
pages-app.yaml
ordam.subApps.yaml
. -
Add the
searchEnabled
property and set it tofalse
.
The example below shows the configuration to disable the asset type, author, size, and status filters as well as the search field in the Assets app.
resources/dam-app-jcr/decorations/dam-assets-app/apps/dam.subApps.yaml
workbench:
searchEnabled: false
filters: