Skip to content

Enabling cross locale searching for SOLR 6

Angel Borroy edited this page Dec 18, 2018 · 3 revisions

SOLR 6 is configured by default to search only using one locale (e. g. English). Following instructions describe how to configure SOLR 6 to provide cross locale searching, that is, a user with the browser in Spanish language will obtain the same searching results as a user with a browser in English language.

  1. Comment image property in solr6 service at docker-compose.yml by a local image tag build
    solr6:
#        image: alfresco/alfresco-search-services:1.2.0
         build: ./solr6

As original image 1.2.0 provided by Alfresco is exposing also configuration folder solrhome as VOLUME (just don't ask me why), there is no way to modify default configuration by using sed or echo commands. So you need to copy some lines from original image in order to deploy these properties.

  1. Create a folder solr6 with a Dockerfile inside having following contents
FROM alfresco/alfresco-search-services:1.2.0

COPY entrypoint.sh $DIST_DIR/solr/bin/
USER root
RUN chmod +x $DIST_DIR/solr/bin/entrypoint.sh

USER solr
CMD $DIST_DIR/solr/bin/entrypoint.sh
  1. Create entrypoint.sh script in the same folder in order to modify containers resources on initialization (instead of image resources on building)
#!/bin/bash
set -e

sed -i "/alfresco.cross.locale.datatype/s/^#//g" \
  $DIST_DIR/solrhome/conf/shared.properties

# This command is copied directly from CMD section at 
# https://github.com/Alfresco/SearchServices/1.2.0/packaging/src/docker/Dockerfile
# CAUTION! This line has to be reviewed for every new image published by Alfresco
$DIST_DIR/solr/bin/solr start -f
  1. Remove data/solr-data contents
$ rm -rf data/solr-data/
  1. Restart Docker Compose by building images
$ docker-compose up --build

Note Alternatively you can mount your shared.properties file using a Docker Compose volume mapping for solr6 service.

        volumes:
            - ./volumes/config/solr/shared.properties:/opt/alfresco-search-services/solrhome/conf/shared.properties

So you don't need to create a shell, but you are still overwriting an Alfresco resource (shared.properties)