Book Image

Apache Solr High Performance

By : Surendra Mohan
Book Image

Apache Solr High Performance

By: Surendra Mohan

Overview of this book

Table of Contents (14 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 in the Lucene Java search library as the core, which is primarily used for full-text indexing and searching. Additionally, the Solr core consists of REST-like HTML/XML and JSON APIs, which make it 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 geospatial search. Reliability, scalability, and fault tolerance capabilities make Solr even more demanding to developers, especially to SEO and DevOp professionals.

Apache Solr High Performance is a practical guide that will help you explore and take full advantage of the robust nature of Apache Solr so as to achieve optimized Solr instances, especially in terms of performance.

You will learn everything you need to know in order to achieve a high performing Solr instance or a set of instances, as well as how to troubleshoot the common problems you are prone to facing while working with a single or multiple Solr servers.

What this book covers

Chapter 1, Installing Solr, is basically meant for professionals who are new to Apache Solr and covers the prerequisites and steps to install it.

Chapter 2, Boost Your Search, focuses on the ways to boost your search and covers topics such as scoring, the dismax query parser, and various function queries that help in boosting.

Chapter 3, Performance Optimization, primarily emphasizes the different ways to optimize your Solr performance and covers advanced topics such as Solr caching and SolrCloud (for multiserver or distributed search).

Chapter 4, Additional Performance Optimization Techniques, extends Chapter 3, Performance Optimization, and covers additional performance optimization techniques such as fetching similar documents to those returned in the search results, searching homophones, geospatial search, and how to avoid a list of words (usually offensive words) from getting searched.

Chapter 5, Troubleshooting, focuses on how to troubleshoot the common problems, covers methods to deal with corrupted and locked indexes, thereby reducing the number of files in the index, and how to truncate the index size. It also covers the techniques to tackle issues caused due to expensive garbage collections, out-of-memory, too many open files, and infinite loop exceptions while playing around with the shards. Finally, it covers how to update a single field in all the documents without completing a full indexation activity.

Chapter 6, Performance Optimization with ZooKeeper, is an introduction to ZooKeeper and its architecture. It also covers steps to set up, configure, and deploy ZooKeeper along with the applications that use ZooKeeper to perform various activities.

Appendix, Resources, lists down the important resource URLs that help aspirants explore further and understand the topics even better. There are also links to a few related books and video tutorials that are recommended by the author.

What you need for this book

In 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 (one of the latest versions), Apache Solr 4.x, and a Solr PHP client.

A couple of concepts covered in this book require additional software/tools such as the Tomcat add-on and ZooKeeper.

Who this book is for

Apache Solr High Performance is for developers or DevOps who have hands-on experience working with Apache Solr and who are targeting to optimize Solr's performance. A basic working knowledge of Apache Lucene is desirable so that the aspirants get the most of it.


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, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "Let us start by adding the following index structure to the fields section of our schema.xml file."

A block of code is set as follows:

<field name="wm_id" type="string" indexed="true" stored="true" required="true" />
<field name="wm_name" type="text" indexed="true" stored="true" termVectors="true" />

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

# http://localhost:8983/solr/select?q=sonata+string&mm=2&qf=wm_name&defType=edismax&mlt=true&mlt.fl=wm_name&mlt.mintf=1&mlt.mindf=1

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.