This post is the first of a series dedicated to Solr search engine use in Omeka S.
In this post we’ll see how to install the required modules and configure them to have a minimalist but functional search page.
Then, the PHP extension Solr, which is required by Solr module:
apt-get install php-solr
Lastly, we just need to go to the Omeka S administration interface and to enable the two modules.
Now that the installation is done, let’s move on to configuration. For this first post, we are going to do the simplest thing: a text input that only allow to search in items title. No sort options, no facets.
Solr module configuration
The first step is to configure the Solr node. If it’s not done already, we need to start by creating a Solr core:
bin/solr create_core -c omeka-s
Then, we need to go to the Omeka S administration interface, in Solr section.
We can see that the node installed by default is badly configured. The core path (
solr/default) is not correct. Let’s modify it.
The next step is to configure the indexation fields. This step is crucial, it allows to define which data will get saved in Solr, and how they will be treated by the search engine. To start, click on .
Then, go to items configuration (gear wheels icon in front of Item)
No mappings are defined by default. Let’s add one for the title.
The source is the Omeka field (here Dublin Core:Title) that we want to index. The name of the Solr field determines its type. It can be of type text, string, integer, boolean, … Each one has a different use. For instance, the string type will more likely be used for sorting or for facets, whereas the text type will be used for keyword searches. So, for the title we use the text type.
Now we need a search field. Search fields are groups of indexation fields. They allow for example to have an “All metadata” search field which will search in multiple Solr fields. However they are mandatory even if we want to use only one Solr field.
Let’s go back to the main screen of Solr module. Search fields configuration can be accessed by clicking on the magnifying glass icon.
Let’s add a search field.
Finally, the last step for this module is to define which Solr fields will be used by default. To do that, we need to go back to the node configuration and then set the
Search module configuration
Let’s move on to the Search module. We will need to create an index and a search page. Let’s start with the index.
The index is now created, but it is empty. For Omeka to save existing items into Solr, we need to rebuild the index by clicking on the icon representing two arrows in a circle.
Omeka will rebuild the index in a background job. Meanwhile, we can create the search page.
We are almost done ! We just need to add the search page to the site navigation.
And voilà !