Skip to content
Cliff Ingham edited this page Sep 4, 2020 · 8 revisions

CRM allows for custom fields to be defined at both the Ticket level and the Issue level. Storing additional fields on an ad-hoc basis in a relational database makes searching for records based on those fields very challenging.

To solve this, CRM indexes all Ticket records in Solr for searching. Solr lets us save whatever fields are required for each record and still search across all of the fields. Solr documents do not need to have the same set of fields from one document to the next.

Installing

These instructions work for Solr 7.4+. Previous Solr web apps have slightly more involved ways of configuring multiple cores. The overall process is the same, just the contents of the actual configuration xml files are going to be different.

These are the abridged instructions. They only cover how to install Solr as a war file in Tomcat. If your Java environment is different, you should refer to the full instructions on the Solr Guide https://lucene.apache.org/solr/guide/. Again, all of these directories are the ones I typically use for web applications. (Your server and directory decisions are your own.)

Download and Extract

Download the binary release of Solr from http://lucene.apache.org/solr. I put the tarball into /usr/local/src and extract it there.

sudo /usr/local/src
sudo tar xzvf solr-7.4.x.tgz

Run the installer

The binary release includes an installation script, which works great.

cd /usr/local/src/solr-7.4.x.tgz/bin
sudo ./install_solr_service.sh ../../solr-7.4.x.tgz -i /usr/local/solr -d /srv/solr

Configure the core

We need to tell Solr about the fields we're indexing. Also, modern Solr ships with dynamic fields, by default, which we do not want, as are specifying our own here. We need to disable the "Managed Schema".

cd /usr/local/solr/bin/solr
sudo ./solr create -c ureport

cd /srv/sites/crm/scripts/solr
sudo cp solrconfig.xml /srv/solr/data/ureport/conf
sudo cp schema /srv/solr/data/ureport/conf
sudo rm -Rf /srv/solr/data/ureport/conf/managed-schema
sudo service solr stop
sudo service solr start

Configuring CRM to talk to Solr

Once Solr is up and running, you can edit site_config.inc

/**
 * Point to the Solr server
 */
define('SOLR_SERVER_HOSTNAME', 'localhost');
define('SOLR_SERVER_PORT', 8983);
define('SOLR_SERVER_PATH', '/solr/ureport');
Clone this wiki locally