--- layout: m1x title: How to Install and Configure the Solr Search Engine With Magento Enterprise Edition (EE) 1.x ---
Magento Enterprise Edition (EE) versions 1.8.0.0 and later enable you to configure either of the following as a catalog search engine:
Solr enables you to provide your web store users with a powerful full-text search engine that includes:
See one of the following sections for more information:
This guide is intended for Magento EE administrators and systems integrators who have some familiarity with search engines—ideally, who also have Solr configuration experience. No programming is required to perform the tasks discussed in this guide.
This guide discusses a simple Solr configuration that uses the example Solr configuration provided with Solr, default Solr integration options provided with Magento EE, and also explains how to configure Magento EE to use Solr. Advanced configuration tasks—such as setting up dictionaries—are beyond the scope of this guide.
The following table provides a quick comparison between Magento with the default MySQL full text search and Magento with Solr search.
| Feature | Magento with MySQL full-text search | Magento with Solr search |
|---|---|---|
| Full text search | Yes and also supports two additional search modes:
| Yes† |
| Search recommendations | Yes | Yes |
| Faceted search (used in layered navigation) | Yes | Yes |
| Range (such as price range) | Yes | Yes |
| Sort-by options (for example, sort by relevance) | Yes | Yes |
| Zero results tips or results correction | No | Yes |
| Suggestions | No | Yes |
| Clustering | No | Yes |
| Attribute weight based on attribute settings | No | Yes |
| Search localized characters | No | Yes |
| Word delimiter (for example, searching for spider man or spiderman return spider-man) | No | Yes |
The following table summarizes what versions of Magento EE work with what versions of Solr.
| Magento EE version | Compatible Solr version(s) | Comment |
|---|---|---|
| EE 1.14.x.x | Any version up to 3.6.2. | No patch is required to use EE 1.14.x.x with Solr 3.6.2. Click here to browse the list of all available Solr versions. |
| EE 1.13.x.x | Any version up to 3.6.2. | Click here to browse the list of all available Solr versions. |
| EE 1.12.0.x | Any version up to 3.5.0 | If you use a later version, such as 3.6.x, see Information About Enterprise Edition (EE) Patches for Apache Solr to get a patch. Click here to browse the list of all available Solr versions. |
| EE 1.8.0.0 to 1.11.0.2 | Any version up to 3.4.0. | To use a Solr version later than 1.4.x, see Information About Enterprise Edition (EE) Patches for Apache Solr to get a patch. Click here to browse the list of all available Solr versions. |
Solr runs as a standalone full-text search server in a servlet container such as Jetty (which is used by the Solr example configuration) and Tomcat.
Solr uses the Lucene Java search library for full-text indexing and search. Your applications interact with Solr using HTTP POST (in JSON, XML, CSV, or binary formats) to index documents and using HTTP GET to retrieve search results back as JSON, XML, or a variety of other formats (Python, Ruby, PHP, CSV, binary, and so on). If you're a programmer, try the Solr tutorial. Whether you're a programmer or not, read the Solr FAQ.
No programming is required to implement Solr as discussed in this guide.
Solr's powerful external configuration allows it to be tailored to almost any type of application without Java coding, and it has an extensive plug-in architecture when more advanced customization is required. Solr is highly scalable, providing distributed search and index replication.
In this guide, you'll use the example configuration provided with Solr and Magento's provided Solr configuration to implement a simple, quick integration with Solr.
Some reasons to use Solr with Magento include:
Following is a simple comparison of the default MySQL full-text search and Solr search using Magento EE 1.14.0.0 and Solr 3.6.2. Magento EE catalog content is provided by sample data you can download from Magento.
Among the many options Solr gives you is the option to suggest names of products in the event the user enters an incomplete or incorrect search term in your Magento store's Search field.
Using the default MySQL full-text search, if a user enters an incorrect search term (such as shirrt instead of shirt, no results display as the following figure shows.
Using Solr, if a user enters an incorrect search term, suggestions display as the following figure shows.
In addition, if a user enters an incomplete search term, Magento provides dictionary-based suggestions as the following figure shows.
The tasks discussed in this guide require the following:
java -versionIf the message java: command not found displays, you must install the Java SDK as discussed in the next section. If Java is installed, make sure it's version 1.6 or later.
The following sections discuss how to install the prerequisite software:
To install the Java 6 SDK, enter the following command as a user with root privileges:
apt-get install openjdk-6-jdk
To install Java 7, enter the following command as a user with root privileges:
apt-get install openjdk-7-jdk
The Apache Solr package installs both Solr and Jetty. If Jetty is already installed, see the Solr with Jetty Wiki for more information.
To install Solr and Jetty:
If you're not sure what version of Solr to use, see Support Matrix for Solr and Magento EE.
cd empty-directory wget http://archive.apache.org/dist/lucene/solr/3.6.2/apache-solr-3.6.2.tgz
wget http://archive.apache.org/dist/lucene/solr/3.6.2/apache-solr-3.6.2.tgz --2012-11-01 16:20:16-- http://archive.apache.org/dist/lucene/solr/3.6.2/apache-solr-3.6.2.tgz Resolving archive.apache.org... 140.211.11.131 Connecting to archive.apache.org|140.211.11.131|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 78673382 (75M) [application/x-tar] Saving to: `apache-solr-3.6.2.tgz' 100%[======================================>] 78,673,382 1.41M/s in 36s 2012-11-01 16:20:52 (2.08 MB/s) - `apache-solr-3.6.2.tgz' saved [78673382/78673382]
tar -xvf apache-solr-3.6.2.tgz
The following topics discuss how to configure Solr to work with Magento EE:
Magento comes packaged with a sample Solr configuration you can use and customize. To get started, you'll copy the Magento configuration to Solr, replacing any existing files. After that you can start Solr and begin configuring Magento to work with it.
To copy the Magento Solr configuration:
cd [your Solr install dir]/example/solr/conf cp -R [your Magento install dir]/lib/Apache/Solr/conf/* .
cd /etc/solr/apache-solr-3.6.2/example/solr/conf cp -R /var/www/magento/lib/Apache/Solr/conf/* .
<dataDir>${solr.data.dir:./solr/data}</dataDir>
Change it to:<dataDir>${solr.data.dir:}</dataDir>java -jar [your Solr install dir]/example/start.jar
This section discusses how to configure Magento EE to use the Solr search engine.
To configure Magento to work with Solr:
| Option | Description |
|---|---|
| Search Engine | Click Solr |
| Solr Server Hostname | Enter the fully qualified host name or IP address of the machine running Solr. (If Solr is running on the same host as Magento, you can optionally use 127.0.0.1.) |
| Solr Server Port | Enter Solr's listen port. (The example Jetty servlet container uses 8983. The default for Tomcat is usually 8080.) |
| Solr Server Username | Optional. Enter a user name for Solr authentication, if desired. |
| Solr Server Password | Optional. Enter the user's password, if desired. |
| Solr Server Timeout | Enter a connection timeout value, in seconds. |
| Solr Server Path |
Specifies the path and name of the Solr web application. The path used by the example Solr configuration is solr. If you customized Solr, the value you enter in this field must exactly match the value of webapp_name=value in [your Solr install dir]/example/solr/conf/scripts.conf. |
| Indexation Mode | Specifies how Solr processes indexed content. From the Indexation Mode list, click one of the following:
|

| Button state | Meaning |
|---|---|
![]() |
The test connection succeeded. Click Save Config and continue with the next section. |
![]() |
The test connection failed. Try the following:
|
This section discusses how to configure Magento to work with Solr using options in the Admin Panel. Although additional Solr customization is possible, it is beyond the scope of this guide.
To configure Magento to work with Solr:
| Option | Description |
|---|---|
| Minimal Query Length | Enter the minimum number of characters permitted for a catalog search. |
| Maximum Query Length | Enter the maximum number of characters permitted for a catalog search. |
| Search Engine Solr Server Hostname Solr Server Port Solr Server Username Solr Server Password Solr Server Timeout Solr Server Path Indexation Mode |
Discussed in Configuring Solr to Work With Magento. |
| Enable Search Suggestions | Suggestions are the native Solr mechanism of advising users in the event they enter incomplete or incorrect user input. Suggestions, when enabled, are automatically provided as part of any search request. Solr completes incomplete or incorrect input using a dictionary that is based on the main index (and can be customized using configuration files to use any other arbitrary dictionary). Suggestions display with default text "Did you mean:" in the search results page if needed. Notes:
|
| Search Suggestions Count | Enter the maximum number of suggestions to return. |
| Show Results Count for Each Suggestion | The default option, No, displays only the suggestion and not the number of results for each suggestion. Click Yes to display the number of results for each suggestion. |
| Enable Search Recommendations | Recommendations display terms related to a requested word or phrase on the search results page. This functionality is not based on third party engine functionality, but is implemented as part of the Enterprise_Search module and can be shown with the Solr search suggestions block. By default, Magento uses the Enterprise_Search_Model_Adapter_HttpStream module for recommendations. If you install the Apache Solr PHP extension, Magento automatically uses the Enterprise_Search_Model_Adapter_PhpExtension adapter instead. Both adapters function in the same way with no difference in performance. However, the PhpExtension adapter is not tested by Magento so you must thoroughly test any modifications you make to it before deploying it in a production environment. |
| Search Recommendations Count | Enter the maximum number of recommendations to return. |
| Show Results Count for Each Recommendation | The default option, No, displays only the recommendation and not the number of results for each recommendation. Click Yes to display the number of results for each recommendation. |
| Enable Solr Engine for Catalog Navigation | Click Yes (the default) to use Solr to enable layered navigation in the category view. Click No to use the database for layered navigation in the category view. |
After you change the Solr configuration, you must reindex the catalog search index and refresh the full page cache as follows:

cd /var/www/html/magento/shell
php indexer.php --reindex catalogsearch_fulltext
In a production environment, you should start and stop Solr using a script.
Create a script named /etc/init.d/solr with options similar to the following:
#!/bin/sh
#Starts, stops, and restarts Apache Solr.
#chkconfig: 35 92 08
#description: Starts and stops Apache Solr
SOLR_DIR="[your Solr install dir]"
JAVA_OPTIONS="-Xmx1024m -DSTOP.PORT=jetty-stop-port -DSTOP.KEY=jetty-stop-key -jar start.jar"
LOG_FILE="path-to-solr-log-file"
JAVA="java_home"
case $1 in
start)
echo -n "Starting Solr"
cd $SOLR_DIR
$JAVA $JAVA_OPTIONS 2> $LOG_FILE &
;;
stop)
echo -n "Stopping Solr"
cd $SOLR_DIR
$JAVA $JAVA_OPTIONS --stop
;;
restart)
$0 stop
sleep 1
$0 start
;;
*)
echo "Usage: $0 {start|stop|restart}" >&2
exit 1
;;
esac
All parameters shown in the following table are required.
| Value | Description |
|---|---|
| [your Solr install dir] | The absolute file system path to your Solr installation. (For example, /etc/solr/apache-solr-3.6.2 |
| jetty-stop-port jetty-stop-key |
Security parameters used to prevent malicious attempts to stop Jetty. For -DSTOP.PORT=, specify any unused port. For -DSTOP.KEY=, specify a string. If you omit a value for -DSTOP.KEY=, Jetty generates a random key you must enter to stop Jetty. For more information, see Securing Jetty. |
| path-to-solr-log-file | Absolute file system path to the Solr log file. (For example, /var/log/solr.log) |
| java_home | Absolute file system path to your Java executable. (For example, /usr/bin/java) |
An example follows:
#!/bin/sh
#Starts, stops, and restarts Apache Solr.
#chkconfig: 35 92 08
#description: Starts and stops Apache Solr
SOLR_DIR="/etc/solr/apache-solr-3.6.2/example"
JAVA_OPTIONS="-Xmx1024m -DSTOP.PORT=8079 -DSTOP.KEY=mykey -jar start.jar"
LOG_FILE="/var/log/solr.log"
JAVA="/usr/bin/java"
case $1 in
start)
echo -n "Starting Solr"
cd $SOLR_DIR
$JAVA $JAVA_OPTIONS 2> $LOG_FILE &
;;
stop)
echo -n "Stopping Solr"
cd $SOLR_DIR
$JAVA $JAVA_OPTIONS --stop
;;
restart)
$0 stop
sleep 1
$0 start
;;
*)
echo "Usage: $0 {start|stop|restart}" >&2
exit 1
;;
esac
To complete the script:
chmod +x /etc/init.d/solr
For additional information about Solr, see the following: