Providing a Solr search

This page describes the Solr Search Provider submodule of the Magnolia Solr module. The submodule contains templates allowing you to display search results on a site. It also provides an autocomplete bar with search suggestions functionality and also faceted search components for additional refining of search results.

The Solr module integrates Apache Solr, a standalone enterprise-grade search server with a REST-like API, for indexing and crawling of Magnolia content, especially if you need to manage assets in high volumes (100,000+ DAM assets).

Creating a search results page

Create a search results page using one of the available templates. Which template you use depends on the type of project you have and the modules that are installed.

Module Template Configuration







To try it in the demo travel site:

  1. Make the template available in the site definition.

  2. Create a page which uses the template.

  3. Edit the home page properties.

  4. Select your Solr results page in the Search Page field.

Search result settings

Enter or modify the values in the Search result settings tab of the Page properties dialog:


Using a specific Solr server/core

In the Client field select which client should be used for search. The field displays all clients configured under Configuration > /modules/solr-search-provider/config/solrClientConfigs.

Url domain filtering

You can filter results by a URL domain in the Filter url prefix field:


Field boosting for relevance

The example query title^100 abstract^0.1 set in the Boost query field will boost the rank for the matches in the title field 1000 times more than the equivalent matches in the abstract field.

The query will return the following results:


Conversely, if you decide to boost the abstract field instead of the title field, you will get the following results for the same search. The snippets returned are now primarily from page titles:


Filtering search results

In the Additional filters field you can define filters to narrow the search results, for example filters for positive and negative filtering:

  • Positive filtering: Return only the results where the conference keyword is present:

  • Negative filtering: Don’t return the results where the conference keyword is present:

You can use multiple filters. For more information see Common query parameters: filter query parameter.

The autocomplete search bar provides suggestions while typing in the search field. The jQuery UI Autocomplete widget and are used for this functionality.


  1. Go and download jQuery UI JavaScript for Autocomplete widget and required dependencies.

  2. In the archive downloaded find jquery-ui.js (or jquery-ui.min.js) and jquery.js and add them into Magnolia resources.

  3. Link to the jQuery JavaScript libraries from the search results page:

    <script src="path to jquery.js" type="text/javascript"></script>
    <script src="path to jquery-ui.js" type="text/javascript"></script>
  4. Add the following small JavaScript snippet into the search results page:

    var jq = jQuery.noConflict();
    jq(document).ready(function () {
        jq("#searchbar, #nav-search, #search").autocomplete({
            open: function () {
                jq(this).autocomplete('widget').css('z-index', 999);
            source: function (request, response) {
                jq.get("${contextPath}/searchservlet/", {search: request.term.toLowerCase(), queryType: "SUGGEST", fields: "collation", fq: "*", client: "default"},
                    function (data) {
                    }, "json"
            minLength: 2

More information about the autocomplete feature

For more information about the autocomplete feature see the following AUTO-COMPLETE series of Karel de Witte’s DONE BEFORE YOU TRY blog posts:

Please be aware that these posts may refer to old versions of Solr and Magnolia’s Solr module. Some examples described in the post may therefore not work with the latest version. However, the examples are still inspirational and worth reading.

Other features

  • Pagination

  • Faceting on all fields

  • Ranged faceting

  • Similar search

  • Localized search (a page at Magnolia Community Wiki)

  • Suggestions

dev days event sign up
dev days event sign up