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.
To try it in the demo travel site:
- Make the template available in the site definition.
- Create a page which uses the template.
- Edit the home page properties.
- 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 sever/core
In the Client field select which client should be used for search. The field displays all clients configured under Configuration >
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
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
conferencekeyword is present:
- Negative filtering: Don't return the results where the
conferencekeyword is present:
You can use multiple filters. For more information see Common query parameters: filter query parameter.
Autocomplete search bar
The autocomplete search bar provides suggestions while typing in the search field. The jQuery UI Autocomplete widget and
info.magnolia.search.solrsearchprovider.logic.servlets.SearchServlet are used for this functionality.
- In the archive downloaded find jquery-ui.js (or jquery-ui.min.js) and jquery.js and add them into Magnolia resources.
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:
- ADDING MAGNOLIA CONTENT TO SOLR
- SOLR SUGGESTION HANDLER
- ADDING THE SOLR SERVLET LOGIC TO MAGNOLIA
- ADDING THE CSS TO SHOW THE AUTOCOMPLETE
- ADDING THE JQUERY SCRIPT TO SHOW THE AUTOCOMPLETE
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.
- Faceting on all fields
- Ranged faceting
- Similar search
Localized search (a page at Magnolia Community Wiki)