'Setting Up a Solr Index '

Setting up a solr index isn’t that hard, but I found the documentation to be somewhat hard to find. It only took me a few hours from start to finish to go from download to indexing my documents, but I think it could have happened a lot faster if I had some of the below information. I’m assuming you’ve already downloaded solr and you’re now looking at a directory with a bunch of files in it.

  • Make a copy of the example directory found in the solr directory. To make obvious, I just named it after the site I’m working on.

  • You’ll want to edit the solr/conf/schema.xml file found in there. It’s actually a really good sample file to get started with, so you’ll learn a whole bunch by starting there. Information on the solr schema. You’ll need to modify the configuration file for solr to function correctly with your schema.

  • If you’re using a PHP and curl, and you get the error “missing content stream”, you need to make sure you set your curl header

curl_setopt($c, CURLOPT_HTTPHEADER, array(“Content-Type: text/xml”));

  • At one point, I received the error “Unexpected EOF in prolog” - this was because I originally had a “\n” at the end of my header (see previous note). Removing it solved my problem.

Here’s a good solr starting point that covers the schema and field types.

If you found this post helpful, please consider sharing to your network. I'm also available to help you be successful with your distributed systems! Please reach out if you're interested in working with me, and I'll be happy to schedule a free one-hour consultation.