You are here

Installing Apache solr locally for testing (Windows)

You may be using Apache solr search on your production Drupal site (maybe even through your Acquia hosting, where it comes as a free option), but may have been testing on your local version of your site without that search option enabled. I've found the documentation on setting up Solr locally for your Drupal site a little lacking online, so here is a tutorial on how I did it myself.  Now testing on my local site is easy, since my two search environments are pretty much identical!

Setting up solr locally

  1. Download the Drupal Apache Solr module from and install it in sites/all/modules/apachesolr
  2. Download the latest version of Apache Solr from and unpack it into a directory of your choice (outside of your Drupal root folder).  In this example, I've unpacked it into a C:\Apache_solr directory.
  3. From sites/all/modules/apachesolr/solr-conf, copy the files schema.xml, solrconfig.xml and protwords.txt to C:\Apache_solr\example\solr\conf

Running the Solr server

  1. Run a command prompt
  2. Navigate to c:\Apache_solr\example
  3. Run java -jar start.jar to launch the solr server
    >> cd C:/Apache_solr/example
    >> java -jar start.jar
  4. Verify that it is running properly by inspecting for any errors in the output or visiting http://localhost:8983/solr/admin/
    1. You should see a lot of 'INFO' statements in the command window's output letting you know what's been loading and running, but not errors
    2. The http://localhost:8983/solr/admin/ link gives you an interface on your computer to query your solr search index outside of your drupal website
  5. When you are done testing/working with Solr you can stop the server by pressing Ctrl+C in the command line and exiting.

How it works with Drupal

  1. Enable the Solr modules in Drupal as usual
    1. At a minimum, enable Apache Solr framework and Apache Solr search
    2. I also use the Facet Api module, Apachesolr_sort, and there are many contrib modules which can improve Solr's functionalities further.
  2. Go to admin/config/search/settings and select 'Apache solr search' as the default search (to replace Drupal core search) or else create a new separate search page in the apache configuration page in #4 below
  3. The default module settings (i.e. localhost on port 8983) work for this local configuration!
  4. Run cron to index the site's content or use the Apache Solr index page (/admin/config/search/apachesolr) to fill in the search index.
  5. You may notice a small delay (of a few minutes) between the time a node is indexed and when it begins appearing in searches




Error 404 - Not Found.
No context on this server matched or handled this request.
Contexts known to this server are:

/solr ---> o.e.j.w.WebAppContext{/solr,file:/C:/Apache_solr/example/solr-webapp/webapp/},C:\Apache_solr\example/webapps/solr.war [failed]

Add new comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.