Skip to content

Commit 50b527a

Browse files
committed
Added verbose instructions for Solr 7 and Drupal 7
1 parent 42a8ac6 commit 50b527a

File tree

1 file changed

+55
-6
lines changed

1 file changed

+55
-6
lines changed

README.md

Lines changed: 55 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,28 +14,75 @@ This repository allows you to quickly install Apache Solr for Drupal 9+ into a [
1414

1515
## Installation on Drupal 9+
1616

17-
1. `ddev add-on get ddev/ddev-drupal-solr && ddev restart`
17+
1. Install this add-on: `ddev add-on get ddev/ddev-drupal-solr && ddev restart`
1818
2. You may need to install the relevant Drupal requirements: `ddev composer require drush/drush drupal/search_api_solr`
1919
3. Enable the `search_api_solr` module either using the web interface or `ddev drush en -y search_api_solr`
2020
4. Create a Search API server at `admin/config/search/search-api` -> "Add server"
21-
5. Create a server with the following settings
21+
5. Configure the server with the following settings:
2222
* Set "Server name" to anything you want. Maybe `ddev-solr-server`.
2323
* Set "Backend" to `Solr`
2424
* Configure Solr backend
2525
* Set "Solr Connector" to `Standard`
2626
* Set "Solr host" to `solr`
2727
* Set "solr core" to `dev`
2828
* Under "Advanced server configuration" set the "solr.install.dir" to `/opt/solr`.
29+
6. Restart Ddev: `ddev restart`.
30+
31+
## Installation on Drupal 7
32+
33+
### Ddev / Solr configuration
34+
35+
1. Install this add-on: `ddev add-on get ddev/ddev-drupal-solr`
36+
2. Set the version of Solr verison 7: Edit the `.ddev/docker-compose.solr.yaml` file. Replace `image: solr:8` with `image: solr:7` on line 34.
37+
3. Add the schema needed for version 7: Defaults can be found in the Search API Solr in the `search_api_solr/solr-conf/7.x` directory . Copy these files into `.ddev/solr/conf`.
38+
4. Restart Ddev: `ddev restart`.
39+
5. Confirm Solr is working by visiting `http://<projectname>.ddev.site:8983/solr/`.
40+
41+
6. If the Ddev drush version is too new for Drupal 7, you may need to symlink `drush` to the `drush8` provided with Ddev. You can do this by adding a `post-start` hook inside your `.ddev/config.yaml` file as follows
42+
```
43+
hooks:
44+
post-start:
45+
- exec: ln -s /usr/local/bin/drush8 /usr/local/bin/drush
46+
```
47+
7. Restart Ddev: `ddev restart`.
48+
49+
### Drupal configuration
50+
51+
1. You may need to install the relevant Drupal modules: `ddev drush dl search_api_solr`.
52+
2. Enable the `search_api_solr` module either using the web interface or `ddev drush en -y search_api_solr`
53+
4. Create a Search API server at `admin/config/search/search-api` -> "Add server"
54+
5. Configure the server with the following settings:
55+
* Set "Server name" to anything you want. Maybe `ddev-solr-server`.
56+
* Set "Protocol" to `http`
57+
* Set "Solr host" to `solr`
58+
* Set "Solr port" to `8983`
59+
* Set "path" to `/solr/dev`.
60+
The "Solr server URI" should be `http://solr:8983/solr/dev` when done.
61+
6. Create a Search API index at `admin/config/search/search-api` -> "Add index"
62+
7. Configure the index as needed, but this is common:
63+
* Set "Server name" to anything you want. Maybe `ddev-solr-index-content`.
64+
* Set "item type" to `content`
65+
* Set the server to `ddev-solr-server` (or whaver the name is)
66+
* Index the site.
67+
8. Build a new view of indexed content `ddev-solr-index-content` (or whatever the name is)
68+
7. Configure the view as needed.
2969

30-
6. `ddev restart`
3170

3271
## Outdated Solr config files
3372

3473
If you get a message about Solr having outdated config files, you need to update the included Solr config files.
3574

75+
### Drupal 9+:
76+
3677
1. Click "Get config.zip" on the server page
3778
2. Unzip the files, and put the config files into `.ddev/solr/conf/`
38-
3. Run `ddev restart`
79+
3. Restart Ddev: `ddev restart`
80+
81+
### Drupal 7
82+
83+
1. Locate the example files in the `search_api_solr/solr-conf/7.x` directory .
84+
2. Copy these files into `.ddev/solr/conf`.
85+
4. Restart Ddev: `ddev restart`.
3986

4087
### Other frameworks
4188

@@ -45,7 +92,7 @@ See [the documentation in the `doc` folder](doc/README.md)
4592

4693
This is the classic Drupal `solr:8` image recipe used for a long time by Drupal users and compatible with `search_api_solr`.
4794

48-
* It installs a [`.ddev/docker-compose.solr.yaml`](docker-compose.solr.yaml) using the solr:8 docker image.
95+
* This add-on installs a [`.ddev/docker-compose.solr.yaml`](docker-compose.solr.yaml) using the `solr:8` docker image.
4996
* A standard Drupal 9+ Solr configuration is included in [.ddev/solr/conf](solr/conf).
5097
* A [.ddev/docker-entrypoint-initdb.d/solr-configupdate.sh](solr/docker-entrypoint-initdb.d/solr-configupdate.sh) is included and mounted into the Solr container so that you can change Solr config in `.ddev/solr/conf` with just a `ddev restart`.
5198

@@ -72,4 +119,6 @@ You can delete the "dev" core from `http://<projectname>.ddev.site:8983/solr/#/~
72119

73120
## Caveats
74121

75-
* This recipe won't work with versions of Solr before `solr:8`, and Acquia's hosting [requires Solr 7](https://docs.acquia.com/acquia-search/). You'll want to see the [contributed recipes](https://github.com/ddev/ddev-contrib) for older versions of Solr.
122+
* This recipe is designed for versions of Solr `solr:8` and beyond. Acquia's hosting [requires Solr 7](https://docs.acquia.com/acquia-search/). You'll want to follow the Drupal 7 instructions above, or see the [contributed recipes](https://github.com/ddev/ddev-contrib) for older versions of Solr.
123+
124+

0 commit comments

Comments
 (0)