Skip to content

Solr-Drupal#

Standard use#

For Solr 8 and 9, we ship the default schema files provided by the search_api_solr Drupal module. Add the Solr version you would like to use in your docker-compose.yml file, following our example.

Custom schema#

To implement schema customizations for Solr in your project, look to how Lagoon creates our standard images.

  • In the solr section of your docker-compose.yml file, replace image: uselagoon/solr:8 with:
docker-compose.yml
  build:
    context: .
    dockerfile: solr.dockerfile
  • Place your schema files in your code repository. We typically like to use .lagoon/solr.
  • Create a solr.dockerfile.
solr.dockerfile
FROM uselagoon/solr:8

COPY .lagoon/solr /solr-conf/conf

CMD solr-recreate drupal /solr-conf && solr-foreground

The goal is to have your Solr configuration files exist at /solr-conf/conf in the image you are building.

Multiple cores#

To implement multiple cores, you will also need to ship your own Solr schema as above. The only change needed is to the CMD of the Dockerfile - repeat the pattern of precreate-core corename /solr-conf/ ; for each core you require.

solr.dockerfile
FROM uselagoon/solr:8-drupal

CMD solr-recreate drupal /solr-conf && solr-recreate more-drupal /solr-conf && solr-foreground