Skip to content

Commit 82526c7

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

File tree

1 file changed

+69
-5
lines changed

1 file changed

+69
-5
lines changed

README.md

Lines changed: 69 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ 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
@@ -29,13 +29,75 @@ This repository allows you to quickly install Apache Solr for Drupal 9+ into a [
2929

3030
6. `ddev restart`
3131

32+
## Installation on Drupal 7
33+
34+
### Ddev / Solr configuration
35+
36+
1. Install this add-on: `ddev add-on get ddev/ddev-drupal-solr`
37+
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.
38+
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`.
39+
4. Restart Ddev: `ddev restart`.
40+
5. Confirm Solr is working by visiting `http://<projectname>.ddev.site:8983/solr/`.
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+
48+
### Drupal configuration
49+
50+
1. You may need to install the relevant Drupal modules: `ddev drush dl search_api_solr`.
51+
2. Enable the `search_api_solr` module either using the web interface or `ddev drush en -y search_api_solr`
52+
4. Create a Search API server at `admin/config/search/search-api` -> "Add server"
53+
5. Configure the server with the following settings:
54+
* Set "Server name" to anything you want. Maybe `ddev-solr-server`.
55+
* Set "Protocol" to `http`
56+
* Set "Solr host" to `solr`
57+
* Set "Solr port" to `8983`
58+
* Set "path" to `/solr/dev`.
59+
The "Solr server URI" should be `http://solr:8983/solr/dev` when done.
60+
6. Create a Search API index at `admin/config/search/search-api` -> "Add index"
61+
7. Configure the index as needed, but this is common:
62+
* Set "Server name" to anything you want. Maybe `ddev-solr-index-content`.
63+
* Set "item type" to `content`
64+
* Set the server to `ddev-solr-server` (or whaver the name is)
65+
* Index the site.
66+
8. Build a new view of indexed content `ddev-solr-index-content` (or whatever the name is)
67+
7. Configure the view as needed, but this is common:
68+
* Set "View name" to anything you want. Maybe `Solr Search`.
69+
* Set "Show" to `ddev-solr-index-content` (or whatever the name is)
70+
* Tick the box for "Create a page"
71+
* Set the "Page title" to `Search` or whatever you prefer
72+
* Set the "Path" to `/search` or whatever you prefer
73+
* Set "Display format" to `HTML list` + `OL` / `Rendered entity` + `Search result` view mode
74+
* Continue and edit
75+
* Add filters:
76+
* Add an EXPOSED filter for `Search: Fulltext search (exposed)`
77+
* Add additional filters as needed (recommended: `Indexed Content: Status (= Published)`)
78+
* Add sort criteria:
79+
* Add a sort on `Search: Relevance (desc)`
80+
* Set "access control: to `Permission` / `View published content`
81+
* Set "Exposed form style" to `Input required`
82+
* Set "No Results behavior" to `Global:text` / `No results matched your search.`
83+
* (Optional) Set "Exposed form in block" setting
84+
85+
3286
## Outdated Solr config files
3387

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

90+
### Drupal 9+:
91+
3692
1. Click "Get config.zip" on the server page
3793
2. Unzip the files, and put the config files into `.ddev/solr/conf/`
38-
3. Run `ddev restart`
94+
3. Restart Ddev: `ddev restart`
95+
96+
### Drupal 7
97+
98+
1. Locate the example files in the `search_api_solr/solr-conf/7.x` directory .
99+
2. Copy these files into `.ddev/solr/conf`.
100+
4. Restart Ddev: `ddev restart`.
39101

40102
### Other frameworks
41103

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

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

48-
* It installs a [`.ddev/docker-compose.solr.yaml`](docker-compose.solr.yaml) using the solr:8 docker image.
110+
* This add-on installs a [`.ddev/docker-compose.solr.yaml`](docker-compose.solr.yaml) using the `solr:8` docker image.
49111
* A standard Drupal 9+ Solr configuration is included in [.ddev/solr/conf](solr/conf).
50112
* 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`.
51113

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

73135
## Caveats
74136

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.
137+
* 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.
138+
139+

0 commit comments

Comments
 (0)