Skip to content

Commit 1d2b7e9

Browse files
jenlamptonstasadev
authored andcommitted
Added verbose instructions for Solr 7 and Drupal 7
1 parent 94a7aeb commit 1d2b7e9

File tree

1 file changed

+66
-4
lines changed

1 file changed

+66
-4
lines changed

README.md

Lines changed: 66 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ This add-on integrates Solr for Drupal 9+ into your [DDEV](https://ddev.com/) pr
3333
ddev drush en -y search_api_solr
3434
```
3535
4. Create a Search API server at `admin/config/search/search-api` -> "Add server"
36-
5. Create a server with the following settings
36+
5. Configure the server with the following settings:
3737
* Set "Server name" to anything you want. Maybe `ddev-solr-server`.
3838
* Set "Backend" to `Solr`
3939
* Configure Solr backend
@@ -43,13 +43,75 @@ This add-on integrates Solr for Drupal 9+ into your [DDEV](https://ddev.com/) pr
4343
* Under "Advanced server configuration" set the "solr.install.dir" to `/opt/solr`.
4444
6. `ddev restart`
4545

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

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

104+
### Drupal 9+:
105+
50106
1. Click "Get config.zip" on the server page
51107
2. Unzip the files, and put the config files into `.ddev/solr/conf/`
52-
3. Run `ddev restart`
108+
3. Restart Ddev: `ddev restart`
109+
110+
### Drupal 7
111+
112+
1. Locate the example files in the `search_api_solr/solr-conf/7.x` directory .
113+
2. Copy these files into `.ddev/solr/conf`.
114+
4. Restart Ddev: `ddev restart`.
53115

54116
### Other frameworks
55117

@@ -68,7 +130,7 @@ See [the documentation in the `doc` folder](doc/README.md)
68130

69131
This originates from the classic Drupal `solr:8` image recipe used for a long time by Drupal users and compatible with `search_api_solr`.
70132

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

0 commit comments

Comments
 (0)