Information for: DEVELOPERS   PARTNERS

Testing custom Solr configsets with Solr 3/4

Acquia Search allows you to customize your Solr configuration file sets to support more advanced search behavior. Solr configuration files are also called configsets in the Solr community. Acquia recommends you test your configset changes on a local Solr instance to ensure that your site behaves as intended. For the latest Solr version, see Release notes - Acquia Search.

Important

Changing your Solr configuration settings without adequate testing might result in broken site search functionality. You are responsible for testing all custom Solr configset changes before uploading them to your Acquia Search instance.

The following are the prerequisites for the testing procedure:

  • Java is installed and you can run it as an executable from a command prompt.
  • You are using an Acquia Cloud Platform application, but this is generally applicable to regular Drupal sites.

Customizing your files

Acquia recommends adding items to the following files rather than modifying Solr’s schema.xml:

  • schema_extra_fields.xml
  • solrconfig_extra.xml

You can add items to the same directory as your regular Solr schema files. These files are included when your schema.xml loads. Using them prevents you from modifying your approved schema.xml and solrconfig.xml files. Acquia Support must approve any changes to the schema files. Therefore, using the extra* files can significantly improve your ability to get a custom configuration approved.

Note

Acquia does not support modification of the solrconfig.xml file on Acquia Cloud Platform servers. You can modify it for your own testing on your local site.

To test a file such as schema.xml locally, you must prepare your environment, and then configure its Drupal settings.

Prepare your environment

Allow this process to run during your testing. You will need to stop the service using CTRL-C, and then restart it every time you want to test a change to a configuration file.

For testing, you can choose to add some content to a newly-created site or clone an existing site.

  1. Ensure that you have the required Solr search modules downloaded in your Drupal site. The modules do not need to be installed at this step.
  2. Download the Solr package from apache.org and uncompress the file into your user directory. For example, /solr/[VERSION]. You will use this shortly to run a Solr instance locally for your Drupal site to connect to. To run multiple versions, you can have multiple folders.
  3. Change to the directory where you placed Solr, and make a copy of the example folder. Name the folder for the project, such as ~/solr/apache-solr-[VERSION]/myproject. This gives you an instance of the schema.xml or other files that you can configure, while also keeping default copies.
  4. Copy only the files for the matching Solr version from the Drupal module you are using to connect to Solr, into the new project’s solr directory. The source directory depends on the module you are using. Example locations include:
  • Apache Solr Search Integration module: docroot/sites/all/modules/apachesolr/solr-conf/solr-[SOLR VERSION]/*.
  • Search API Solr module: docroot/sites/all/modules/search_api_solr/solr-conf/[SOLR VERSION]/*.

The destination configuration directory depends on the Solr version:

  • Solr 4.5.1: ~/solr/apache-solr-4.5.1/myproject/solr/collection1/conf
  • Solr 3.5: ~/solr/apache-solr-3.5.0/myproject/solr/conf

Copy the source files to the destination directory. This folder is where you will be making any needed changes that you need to test.

  1. (Optional) By default, processing of the queued content takes two minutes. To shorten this time for local testing, edit the local solrconfig.xml file, and change the value to 2000 (two seconds).
  2. Open a command prompt window, change to the ~/solr/apache-solr-[VERSION]/myproject directory, and start the local Solr instance with the following command: java -jar start.jar.

Configure your Drupal settings

After preparing your environment, you must configure your local drupal site to connect to the local Solr instance. The steps vary depending on the module you are using. Therefore, you must see the module-specific documentation.

Use the following Solr endpoint URL during your configuration: http://localhost:8983/solr

Begin your testing

After connecting to the Solr instance, you can test indexing and searching. You can also use the Solr analysis tool at [Solr URL]/admin/analysis.jsp. You only have access to this locally, not on Acquia’s instance.

Note

Whenever you test a change to a Solr configuration file, you must stop the service that you left running in your command line using CTRL-C, and then restart the service after the changes are done.

Troubleshooting

Acquia recommends using the Solr Devel module to debug Solr indexing and queries. For the troubleshooting guide, see Using Solr Devel module to debug Solr indexing and queries.

Additional resources