On Embedded Solr Paths and Http Solr Server Urls

We’ll be working with Solr in NixMash Spring in upcoming releases using both Embedded Solr and Http Solr Server in their respective Spring Profiles. One of the first things to lock down when working with Solr is the logic behind Embedded Solr paths and Http Solr urls. It can be confusing when getting started, but these few basic tips will help.

Embedded Solr Paths

Embedded Solr is cool, like Embedded Tomcat, because you don’t have to setup a traditional Solr Server. Not that setting up a Solr Server is difficult, but like Forrest Gump will wisely tell you, “one less thing.”

Here’s an example of an Embedded Solr path used in NixMash Spring

solr.solr.home=/home/daveburke/tmp/solr-4.10.4/

Here’s the directory structure. collection1 is our Solr Core, which is the default collection Solr 4.x looks for.

Here are our takeaways from the Embedded Solr Path.

  1. We point to the Solr Root, or the directory above our Collection.
  2. We need a solr.xml file in the Embedded Solr Root directory.
  3. Save yourself the aggravation and use Solr’s default collection1 Collection name. Be sure it has a core.properties file (not core.properties.unloaded.)
  4. There is nothing else we need to add to our /solr-4.10.4 folder because the heavy lifting is done by our org.apache.solr-core JAR.

Http Solr Urls

This section will be pretty brief. Here’s an Http Solr url used with NixMash Spring in development.

solr.server.url=http://localhost:8983/solr/collection1/

Here’s what we see when we go to the url, the Solr Server Collection home page for our collection1 core. (The collection1 core is preceded by a /# to view on the web.)

Here are our takeaways from the Http Solr Url.

  1. We point to the Collection itself, not to a parent directory like we did with Embedded Solr
  2. Make sure the Http Solr Server is running before firing up your Spring App