Solr 9 local instance (solr9, :8986, configsets from solr_cores_stage worktree)

- make solr8 / make solr9 switches local Drupal via untracked settings.solr.php
- update_solr_config.sh clears conf/ before unzipping the generated config

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-11 20:33:53 +01:00
co-authored by Claude Opus 5.5
parent 714f8fd2c9
commit 842765d31a
5 changed files with 49 additions and 3 deletions
+20
View File
@@ -0,0 +1,20 @@
#! /bin/bash
# Bascule le Drupal local entre Solr 8 (branche prod) et Solr 9 (branche stage).
# bin/solr_switch.sh 8|9
# Écrit (ou supprime) web/sites/default/settings.solr.php, inclus par settings.php, puis drush cr.
cd "$(dirname "${BASH_SOURCE[0]}")/.." || exit 1
F=public_html/web/sites/default/settings.solr.php
case "$1" in
8) rm -f "$F" ;;
9) cat > "$F" <<'PHP'
<?php
// Généré par bin/solr_switch.sh 9 : Drupal local -> conteneur solr9 (Solr 9)
foreach (['materio', 'database_search_autocomplete'] as $server) {
$config["search_api.server.$server"]['backend_config']['connector_config']['host'] = 'solr9';
$config["search_api.server.$server"]['backend_config']['connector_config']['solr_version'] = '9';
}
PHP
;;
*) echo "usage: $0 8|9" >&2; exit 1 ;;
esac
docker exec materiod8-php-1 drush cr >/dev/null && echo "Drupal local -> Solr $1"
+4 -2
View File
@@ -3,7 +3,7 @@
# puis recharge les cores (RELOAD, sans restart).
#
# bin/update_solr_config.sh -> solr_cores (branche prod, Solr 8, :8985)
# bin/update_solr_config.sh solr_cores_stage URL -> worktree stage (Solr 9, phase 2)
# bin/update_solr_config.sh solr_cores_stage http://localhost:8986/solr -> worktree stage (Solr 9, après make solr9)
#
# Les modifications restent à relire / committer dans l'arbre visé (git diff).
@@ -22,8 +22,10 @@ docker exec -i materiod8-php-1 drush solr-gsc database_search_autocomplete confi
mkdir -p ressources/solr/
mv public_html/web/config.zip ressources/solr/ || exit 1
# conf/ entièrement généré : on vide avant de décompresser (les fichiers retirés apparaissent dans git status)
for core in $CORES; do
unzip -o ressources/solr/config.zip -d "$TREE/$core/conf"
find "$TREE/$core/conf" -type f -delete
unzip -q -o ressources/solr/config.zip -d "$TREE/$core/conf"
done
for core in $CORES; do