Skip to content

Solr

Supported versions

All versions supported by wodby/base-solr can be used.
But Dropsolid Platform currently uses Solr 6.6.5.

Base image

As the official Solr docker images don't have an alpine version anymore (see github issue), we switched to the wodby images

Usage

Solr support can be enabled by passing the --solr service flag when starting up a project.
With the --solr_version service setting you can specify the version.

Services and service settings can also be specified in a .dlp.yml file.
See project configuration for more info.

Endpoints

You can access the Solr admin UI via https://solr.<project>.docker.localhost:444/

Configuration

By default Launchpad provides the necessery config and environment variables to work out of the box.
A core with the project name is created.

Populate the config of the default core on project start

If the Solr configuration info is available in [PROJECT_ROOT]/etc/solr directory of the project, the default core will be pre populated.

Add a core

This can be done through the Solr admin UI.
There is no Launchpad functionality to specify extra cores.

Remove a core

This can be done through the Solr admin UI.

Configure Search API Solr in Drupal

  • When using Search API Solr 8.x-2.x or higher, don't copy the default config from the solr-conf-templates folders, but use the generated config instead.
    See the readme how you can do this with the UI or drush.

  • When using Search API Solr 8.x-2.x or higher, don't forget to set solr.install.dir value to ../../../.. See here and here for documention.

Prune all solr data and config

If somehow you can't delete or update the config of a core through the Solr admin UI, you can manually remove the stored data.

  • stop the project
  • remove [PROJECT_ROOT]/.docker-data/solr
  • start the project again

Assumptions

The machine name of the solr server is the name of your project.

If this isn't the case, copy the snippet from docroot/sites/default/settings.php to etc/drupal/settings_local.php.

D7

This also assumes search_api_solr_overrides module is used and enabled to allow solr config per env.

Replace the highlighted [PROJECT_NAME] (only that one) with the machine name of your solr server.

<?php
// Launchpad Solr config
$conf['search_api_solr_overrides'] = [
  '[PROJECT_NAME]' => [
    'name' => '[PROJECT_NAME] (Overridden)',
    'options' => [
      'host' => "solr.[PROJECT_NAME]-docker",
      'port' => 8983,
      'path' => '/solr',
      'core' => "[PROJECT_NAME]",
    ],
  ],
];

D8

Replace the [PROJECT_NAME] on the first level of the array (only that one) with the machine name of your solr server.

<?php
// Launchpad Solr config
$config['search_api.server.[PROJECT_NAME]']['backend_config']['connector_config']['host'] = "solr.[PROJECT_NAME]-docker";
$config['search_api.server.[PROJECT_NAME]']['backend_config']['connector_config']['path'] = "/solr";
$config['search_api.server.[PROJECT_NAME]']['backend_config']['connector_config']['core'] = "[PROJECT_NAME]";