Book Image

Administrating Solr

By : Surendra Mohan
Book Image

Administrating Solr

By: Surendra Mohan

Overview of this book

Implementing different search engines on web products is a mandate these days. Apache Solr is a robust search engine, but simply implementing Apache Solr and forgetting about it is not a good idea, especially when you have to fight for the search ranking of your web product. In such a scenario, you need to keep monitoring, administrating, and optimizing your Solr to retain your ranking. "Administrating Solr" is a practical, hands-on guide. This book will provide you with a number of clear, step-by-step exercises and some advanced concepts which will help you administrate, monitor, and optimize Solr using Drupal and associated scripts. Administrating Solr will also provide you with a solid grounding on how you can use Apache Solr with Drupal. "Administrating Solr" starts with an overview of Apache Solr and the installation process to get you familiar with Solr. It then gradually moves on to discuss the mysteries that make Solr flexible enough to render appropriate search results in different scenarios. This book will take you through clear and practical concepts that will help you monitor, administrate, and optimize your Solr appropriately using both scripts and tools. This book will also teach you ways to query your search and methods to keep your Solr healthy and well maintained. With this book, you will learn how to effectively implement and optimize Solr using Drupal.
Table of Contents (12 chapters)


Solr is a popular and robust open source enterprise search platform from Apache Lucene. Solr is Java-based and runs as a standalone search server within a servlet container such as Tomcat or Jetty. It is built of Lucene Java search library as the core, which is primarily used for full-text indexing and searching. Additionally, Solr core consists of REST-like HTML/XML and JSON APIs, which makes it easy to be virtually compatible with any programming and/or scripting language. Solr is extremely scalable and its external configuration allows you to use it efficiently without any Java coding. Moreover, due to its extensive plugin architecture, you can even customize it as and when required.

Solr's salient features include robust full-text search, faceted search, real-time indexing, clustering, document (Word, PDF, and so on) handling, and geospacial search. Reliability, scalability, and fault tolerance capabilities make Solr even more demanding to the developers, especially to SEO and DevOp professionals.

What this book covers

Chapter 1, Searching data, covers the steps to install Solr, how request and response are handled, ways to query your Solr for most relevant search results, and how to use faceting, geospacial, and distributed search.

Chapter 2, Monitoring Solr, covers how we can monitor Solr, what performance metrics we should be interested in, and how to monitor Solr by using various monitoring tools such as Opsview, New Relic, and Solr Performance Monitoring.

Chapter 3, Managing Solr, covers basic scripts of managing your Solr, scripts to configure both temporary and permanent Solr logs on Tomcat and Jetty, backup your Solr, and collection distribution scripts which include configuration of scripts, SSH, and Rsyncd setup, and how to manage Solr with Drupal 7.

Chapter 4, Optimizing Solr Tools and Scripts, covers business rules and how to write custom rules using Drools, language detection, comparative study of different language detections such as CLD, LangDetect, and Tika, what is NLP, OpenNLP, how does it function and what the different phases OpenNLP consists of and how to implement Solr operation tool using Drupal 7, and the corresponding contributed Drupal modules.

Appendix, Solr Resources, lists down the necessary and essential resources in the form of reference links, books, and video tutorial, which will help you to explore Solr further.

What you need for this book

With an intention to run most of the examples in the book, you will need a XAMPP or any other Linux-based web server, Apache Tomcat or Jetty, Java JDK (latest version), Apache Solr 4.x, and Solr PHP client.

A couple of concepts in this book will require additional software and/or tools such as Tomcat Add-on, Opsview, New Relic, and Solr performance monitoring.

Who this book is for

Administrating Solr is for developers and Solr administrators who have basic knowledge of Solr and are looking for ways to keep their Solr server healthy and well maintained. Basic working knowledge on Apache Lucene is recommended, but is not mandatory.


In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text, folder names, filenames, file extensions, pathnames, dummy URLs, and user input are shown as follows:

The field definition entry in the solrconfig.xml file tells Solr to look for all the JAR files from the ../../lib directory.

A block of code is set as follows:

<field name="id" type="string" indexed="true" stored="true" required="true" /> 
<field name="title" type="text" indexed="true" stored="true" /> 
<field name="author" type="string" indexed="true" stored="true"/>

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

  <description>LRU Cache(maxSize=512, initialSize=512)</description>
    <stat name="lookups">3251</stat>
    <stat name="hits">3101</stat>
    <stat name="hitratio">0.95</stat>
    <stat name="inserts">160</stat>
    <stat name="evictions">0</stat>
    <stat name="size">160</stat>
    <stat name="warmupTime">0</stat>
    <stat name="cumulative_lookups">3251</stat>
    <stat name="cumulative_hits">3101</stat>
    <stat name="cumulative_hitratio">0.95</stat>
    <stat name="cumulative_inserts">150</stat>
    <stat name="cumulative_evictions">0</stat>

Any command-line input or output is written as follows:

curl http://localhost:8080/solr/mbartists/admin/stats.jsp

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "clicking on the Next button moves you to the next screen".


Warnings or important notes appear in a box like this.


Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to , and mention the book title via the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for all Packt books you have purchased from your account at If you purchased this book elsewhere, you can visit and register to have the files e-mailed directly to you.


Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from


Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.


You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.