# Solr Integration

Solr is an enterprise search platform with full-text search, real-time indexing, dynamic clustering, database integration, and rich document handling. Solr can be integrated into applications built on Entando and is required for multitenant architecture.

This tutorial describes the installation steps for Solr integration, including the generation of the core collection which consists of the index and configuration files. For multitenant applications, a core collection must be generated for the primary or first tenant, and each of the secondary tenants.

# Prerequisites

# Install and Configure Solr

  1. Install Solr Helm charts:
helm repo add apache-solr https://solr.apache.org/charts
helm repo update
  1. Install the Solr and Zookeeper CRDs.
    Note: Creating the CRDs and installing the operators are done at the cluster level and will require cluster-level permissions.
kubectl create -f https://solr.apache.org/operator/downloads/crds/v0.5.0/all-with-dependencies.yaml
  1. Install the Solr and Zookeeper operators:
helm install solr-operator apache-solr/solr-operator --version 0.5.0
  1. Download the template entando-solrCloud.yaml. Adjust the resource settings such as memory, CPU, storage, or replicas using this file.
curl -sLO "https://raw.githubusercontent.com/entando/entando-releases/v7.2.2/dist/ge-1-1-6/samples/entando-solrCloud.yaml"
  1. Create the Solr application resources:
kubectl apply -f entando-solrCloud.yaml -n YOUR-NAMESPACE
  1. Check that the service started properly:
kubectl get solrclouds -w

You should see a response similar to this:

solr   8                         3              3       3            3               79m

# Generate the Core

  1. Set up port forwarding to the Solr common service:
kubectl port-forward service/solr-solrcloud-common 8983:80

Note: kubectl port-forward should be left running.

  1. Open another terminal and call the Solr API to generate the Solr core collection.
    Note: the first core (the primary tenant in a multitenant environment, or the only core in a single tenant environment) must use YOUR-TENANT-NAME="entando" for the collection name below.
Placeholder Description
YOUR-TENANT-NAME The identifying name of the current tenant. In most cases, it will also be used to determine the base URL of the tenant. For example, yoursite results in yoursite.your-domain.com.
curl "http://localhost:8983/solr/admin/collections?action=CREATE&name=YOUR-TENANT-NAME&numShards=1&replicationFactor=3&maxShardsPerNode=2"

The number of shards and shards per node should be adjusted for very large quantities of content, such as 50k or more. In such cases, adjustments to replicas and other resources may be needed.

# Configure the EntandoApp Deployment

  1. Scale down the EntandoApp deployment to 0:
kubectl scale deploy/YOUR-APP-NAME-deployment --replicas=0 -n YOUR-NAMESPACE
  1. Edit the deployment and add the following environment variables:
     - env:
       - name: SOLR_ACTIVE
         value: "true"
       - name: SOLR_ADDRESS
         value: http://solr-solrcloud-common/solr 
  1. Scale the entando-de-app deployment back up to 1 or more deployments:
kubectl scale deploy/YOUR-APP-NAME-deployment --replicas=1 -n YOUR-NAMESPACE

# Generate the Solr Schema

  1. When a new core is added to Solr, its schema also needs to be generated. This is done automatically for the first or primary collection. But for secondary collections, it must be triggered manually by clicking Refresh next to each content type under App BuilderContentSolr Configuration.

  2. Reindex the content using App BuilderContentSettingsReload the indexes.

  3. Confirm Solr is configured and the index is working correctly by using the Search Form widget to confirm Content items can be found via search. This widget is automatically placed in the header of a page created via the Welcome Wizard. For example, searching for platform should return at least one result with the default content set.

# Options

# Direct Access to Solr Configuration

The Solr configuration page can be accessed directly from the Content menu list in the App Builder. The configuration page allows you to monitor and update the schema and reload the indexes for each searchable type.

To enable this option, set the environment variable advancedSearch specification to true in the EntandoApp deployment YAML.