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 the mgnl:asset when the search index is evaluated.

  • Tasks: the mgnl:contentNode content is included in the mgnl:task when the search index is evaluated.

Configuring Find Bar search results

You can configure how many search results are displayed.

To do so:

  1. Open the Resource Files app.

  2. Go to the config.yaml file under the admincentral folder.
    Resource Files app

  3. Edit the file and update the properties that you want to change. For example, update defaultCountPerSupplier to 20 if you want to see up to 20 search results.
    Updating the search results display

  4. Save your changes.

The table below lists properties in the Admincentral module that affect how search results appear.

Table 1. Subset of findBar properties
Property Description

defaultCountPerSupplier

optional, default is 10

Integer defining the maximum number of search results shown from any single search supplier.

editorRoles

optional

List of user roles allowed in the Last editor search filter:
List of authorized user roles

All users are available unless specified otherwise.

By allowing all user roles in editorRoles, you may experience performance issues, especially when a large number of public users are registered in a shared user repository on the author instance and you open a Find Bar filter.

minimumSearchLength

optional, default is 3

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.
Findbar with text hint

suppliers

optional

List of search result suppliers. If undefined, it defaults to all suppliers provided by the Periscope module.

supplierOrder

optional, default is apps, pages, stories, assets, tours

List defining the ordering of search result groups.

Configuring in-app search filters

In-app search is available in the Pages and Assets apps.

To configure existing search filters or add new ones:

  1. Go to the Resource Files app.

  2. Find the filter configuration:

    1. pages-app.yaml for the author, status, and template filters in the Pages app.

    2. pages-content-tags-integration/decorations/pages-app/apps/pages-app.subApps.browser.yaml for the tag filter in the Pages app.

    3. dam.subApps.yaml for the asset type, author, size, and status filters in the Assets app.

    4. content-tags-integration/decorations/dam-assets-app/apps/dam.subApps.yaml for the tag filter in the Assets app.

  3. Look for filteringWorkbench 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:
        $type: filteringWorkbench
        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.

The table below lists filteringWorkbench properties that affect how in-app search results appear. The filteringWorkbench is currently only supported in the Pages and Assets apps.

Table 2. Subset of in-app search properties
Property Description

sortFilterOptions

optional, default is true

Sorts the filters by their labels from A-Z. It gets the order from the definition mapping.

searchEnabled

optional default is true

Enables the full-text search field.

searchPlaceholder

optional, default is Type to search…​

Placeholder text for the full-text-search field.

filters

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.

name

required

The name for the filter.

icon

optional

CSS class that identifies an icon used for the filter. See How to add SVG icons for apps.

$type

required

Use a valid field alias name to reference a field type.

filterOperator

optional

Choose an info.magnolia.ui.filter.FilterOperator for comparing values. Possible values are:

  • EQUALS

  • STARTS_WITH

  • CONTAINS

  • BETWEEN

textInputAllowed

optional, default is false

When true, the user can type into the field to filter available items.

propertyName

optional

The property name.

If no propertyName is set, name is used instead. This is useful if the property name is complex, like mgnl:resource/foo:bar, and not yaml-compliant.

datasource

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 all users

  • Size

    • Small

    • Medium

    • Large

    • Extra large

  • Status

    • Draft

    • Marked for deletion

    • Modified

    • Published

  • Tag

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/ or text/ 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.

Default configuration in resources/dam-app-jcr/decorations/dam-assets-app/apps/dam.subApps.yaml
  workbench:
    $type: filteringWorkbench
    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 Users in the instance.

Default configuration in resources/dam-app-jcr/decorations/dam-assets-app/apps/dam.subApps.yaml
  workbench:
    $type: filteringWorkbench
    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 or b 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.

Default configuration in resources/dam-app-jcr/decorations/dam-assets-app/apps/dam.subApps.yaml
  workbench:
    $type: filteringWorkbench
    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.

Publication status key
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.

Default configuration in resources/dam-app-jcr/decorations/dam-assets-app/apps/dam.subApps.yaml
  workbench:
    $type: filteringWorkbench
    filters:
      - name: jcrPublishingStatus
        icon: icon-spinner-full
        $type: dropdownMultiselect
        datasource:
          $type: enumDatasource
          enumeration: info.magnolia.ui.contentapp.configuration.column.StatusColumnDefinition$PublicationStatus

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.
Default configuration in resources/content-tags-integration/decorations/dam-assets-app/apps/dam.subApps.yaml
  workbench:
    filters:
      - name: mgnl:tags
        icon: icon-tag
        $type: dropdownMultiselect
        textInputAllowed: true
        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 all users

  • Status

    • Draft

    • Marked for deletion

    • Modified

    • Published

  • Tag

  • Template

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.

Default configuration in resources/pages-app/apps/pages-app.yaml
    workbench:
      $type: filteringWorkbench
      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 the Pages or Assets 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:

  1. Go to the Resource Files app.

  2. Find the configuration of the app (pages-app.yaml for Pages, dam.subApps.yaml for Assets).

  3. Under datasource, add the property filterResultsLimit.

  4. Set a value that suits your requirements.

    pages-app/apps/pages-app.yaml
    datasource:
      $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
  5. 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.

    Text says

Disabling in-app search filters and the search field

To disable search filters:

  1. Go to the Resource Files app.

  2. Find the filter configuration:

    1. pages-app.yaml for the author, status, and template filters in the Pages app.

    2. pages-content-tags-integration/decorations/pages-app/apps/pages-app.subApps.browser.yaml for the tag filter in the Pages app.

    3. dam.subApps.yaml for the asset type, author, size, and status filters in the Assets app.

    4. content-tags-integration/decorations/dam-assets-app/apps/dam.subApps.yaml for the tag filter in the Assets app.

  3. Look for filteringWorkbench and remove the configuration of the existing filters under filters.

    The filters are removed from the app, but the search field remains.

To remove the search field:

  1. Find the filter configuration in pages-app.yaml or dam.subApps.yaml.

  2. Add the searchEnabled property set to false.

The example below shows the configuration to disable the asset type, author, size, and status filters in the Assets app, and the search field in the Assets app.

resources/dam-app-jcr/decorations/dam-assets-app/apps/dam.subApps.yaml
  workbench:
    $type: filteringWorkbench
    searchEnabled: false
    filters:
Feedback

DX Core

×

Location

This widget lets you know where you are on the docs site.

You are currently perusing through the DX Core docs.

Main doc sections

DX Core Headless PaaS Legacy Cloud Incubator modules
6.3 beta
X

Magnolia 6.3 beta

Magnolia 6.3 is in beta. We are updating docs based on development and feedback. Consider the 6.3 docs currently in a state of progress and not final.

We are working on some 6.3-beta known issues during this phase.