Search with Solr in Omeka S – #1 – Installation and minimal configuration

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.

Modules installation

First and foremost, we need to install modules Search and Solr:

cd /path/to/omeka-s/modules
wget https://github.com/biblibre/omeka-s-module-Search/releases/download/v0.9.0/Search-0.9.0.zip
unzip Search-0.9.0.zip
rm Search-0.9.0.zip
wget https://github.com/biblibre/omeka-s-module-Solr/releases/download/v0.9.0/Solr-0.9.0.zip
unzip Solr-0.9.0.zip
rm Solr-0.9.0.zip

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.

Configuration

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.

Indexation fields

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 database icon.

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.

Search fields

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 qf parameter.

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à !

Share

2 Comments

  1. Hi, thank you for this article, could you help me with a multilanguage search for items with solr in omeka?

    In omeka I added en and es field in title, but when I search for title in Spanish it gives me back english result.

  2. Hi,

    These modules do not alter how items are displayed. By default Omeka just displays the first value for the title field. You will probably need to have a custom theme, or use something like the Internationalisation module (https://github.com/Daniel-KM/Omeka-S-module-Internationalisation) to get what you want.

Leave a Reply

Your email address will not be published. Required fields are marked *