Skip to content
This repository was archived by the owner on Feb 13, 2023. It is now read-only.

Commit 2d68f03

Browse files
authored
Merge pull request #1134 from jimmyko/master
Create new solr collection instead of using the default one.
2 parents ad7b243 + 79af0f4 commit 2d68f03

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

examples/scripts/configure-solr.sh

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,27 @@
77
# `solr` in the `installed_extras`, and is currently set up for the D7 versions
88
# of Apache Solr Search or Search API Solr.
99

10-
SOLR_SETUP_COMPLETE_FILE=/etc/drupal_vm_solr_config_complete
10+
NAME="d8"
11+
SOLR_SETUP_COMPLETE_FILE="/etc/drupal_vm_solr_config_complete_$NAME"
1112

1213
# Search API Solr module.
1314
SOLR_DOWNLOAD="http://ftp.drupal.org/files/projects/search_api_solr-8.x-1.x-dev.tar.gz"
1415
SOLR_DOWNLOAD_DIR="/tmp"
1516
SOLR_MODULE_NAME="search_api_solr"
1617
SOLR_VERSION="5.x"
17-
SOLR_CORE_PATH="/var/solr/data/collection1"
18+
SOLR_CORE_PATH="/var/solr/data/$NAME"
1819

1920
# Check to see if we've already performed this setup.
2021
if [ ! -e "$SOLR_SETUP_COMPLETE_FILE" ]; then
2122
# Download and expand the Solr module.
2223
wget -qO- $SOLR_DOWNLOAD | tar xvz -C $SOLR_DOWNLOAD_DIR
2324

24-
# Copy the Solr configuration into place over the default `collection1` core.
25-
sudo cp -a $SOLR_DOWNLOAD_DIR/$SOLR_MODULE_NAME/solr-conf/$SOLR_VERSION/. $SOLR_CORE_PATH/conf/
25+
# Copy new Solr collection core with the Solr configuration provided by module.
26+
sudo su - solr -c "/opt/solr/bin/solr create -c $NAME -d $SOLR_DOWNLOAD_DIR/$SOLR_MODULE_NAME/solr-conf/$SOLR_VERSION/"
2627

2728
# Adjust the autoCommit time so index changes are committed in 1s.
2829
sudo sed -i 's/\(<maxTime>\)\([^<]*\)\(<[^>]*\)/\11000\3/g' $SOLR_CORE_PATH/conf/solrconfig.xml
2930

30-
# Fix file permissions.
31-
sudo chown -R solr:solr $SOLR_CORE_PATH/conf
32-
3331
# Restart Apache Solr.
3432
sudo service solr restart
3533

0 commit comments

Comments
 (0)