---
title: "How to test a custom Solr schema file locally"
date: "2023-03-17T23:51:09+00:00"
summary:
image:
type: "article"
url: "/acquia-cloud-platform/help/93106-how-test-custom-solr-schema-file-locally"
id: "6f21f785-4417-44ef-b5ab-931c572834a4"
---

Table of contents will be added

If you need to change your Solr schema, you can test it locally. Acquia Support requires any schema changes to be tested on your own servers before accepting them for production on Acquia Cloud. Be sure to read our documentation on [custom Solr configuration](https://docs.acquia.com/acquia-search/config-solr7/) . You may also find the drupal.org documentation on [Customizing the Solr configuration](https://drupal.org/node/2009760) useful.

Notes

This article aumes the following:

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

This article mentions Solr version 4.5.1, which is not the most recent version. The versions currently available under Acquia Search are 3.5 and 4.5.1.

Rather than modify Solr's `schema.xml`, Acquia recommends adding items into the following files, which you can add to the same directory as your regular Solr schema files:

*   `schema_extra_fields.xml`
*   `solrconfig_extra.xml`

These files are included when your `schema.xml` loads. Using them prevents you from modifying your approved `schema.xml` and `solrconfig.xml` files. Because Acquia Support must approve any changes to the schema files, using the `extra*` files can significantly improve your ability to get a custom configuration approved.

Note for Acquia Cloud users

Acquia dsn't support the modification of the `solrconfig.xml` on the Acquia Cloud servers. However, 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 proce to run during your testing. Note that every time you want to test a change to a configuration file, you will need to stop the service (using CTRL-C) and then restart it.

1.  Optional step: if you don't have a Drupal site running locally, you can [install Acquia Dev Desktop](/node/56001) on your local computer. For testing, you can choose to add some content to a newly-created site or [clone an existing site](/node/57177).  
     
2.  Make sure you have [the required Solr search modules downloaded](/node/62251) (not necearily installed at this point) in your Drupal site.  
     
3.  [Download the Solr package](http://archive.apache.org/dist/lucene) from apache.org and uncompre 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. If you want to run multiple versions, you can have multiple folders.
4.  Change to the directory in which 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.  
     
5.  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. Here are some example locations:
    
    *   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`
    
    You should copy the source files to the destination directory above. This folder is where you will be making any needed changes that you need to test.
    
6.  Optional step: By default, it takes two minutes for the queued content to proce. Make this shorter for local testing by editing the local `solrconfig.xml` and changing the value to `2000` (two seconds).  
     
7.  Open a command prompt window, and 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
------------------------------

Next you should configure your local Drupal site to connect to the local Solr instance. The steps vary depending on the module you are using; please consult each module's documentation.

You should use the following Solr endpoint URL during your configuration: `http://localhost:8983/solr`

Now... test!
------------

After connection, you can now test indexing and searching using this connection. You can also use the Solr analysis tool at \[Solr URL\]/admin/analysis.jsp, which you only have acce to locally and not on Acquia's instance.

Remember that every time you want to test a change to a Solr configuration file, you will need to stop the service that you left running in your command line (using CTRL-C) and then restart it after the changes are done.

Additionally, we recommend [using Solr Devel module to debug Solr indexing and queries](https://support.acquia.com/hc/en-us/articles/360004454253-Using-Solr-Devel-module-to-debug-Acquia-Search-indexing-and-queries) from within Drupal.