Welcome to the Solr cookbook. You will be taken on a tour through the most common problems when dealing with Apache Solr. You will learn how to deal with the problems with Solr configuration and setup, how to handle common querying problems, how to fine-tune Solr instances, how to write Solr extensions, and many more things. Every recipe is based on real-life problems, and each recipe includes solutions along with detailed descriptions of the configuration and code that was used.
Chapter 1, Apache Solr Configuration: In this chapter, you will see how to handle Solr configuration, such as setting up Solr on different servlet containers, how to set up single and multicore deployments, and how to use Solr with Apache Nutch.
Chapter 2, Indexing your Data: In this chapter, you will learn how to send your data in different formats, how to handle binary file format, and what can be done when using the Data Import Handler.
Chapter 3, Analyzing your Text Data: This chapter will tell you how to overcome common problems you may encounter while analyzing your text data.
Chapter 4, Solr Administration: This chapter will guide you through the Solr administration panel, index replication setup, and its maintenance.
Chapter 5, Querying Solr: This chapter will help you with common problems when sending queries to Solr, such as searching for a word, phrase, boosting, sorting, and so on.
Chapter 6, Using Faceting Mechanism: This chapter will show you the beautiful world of the Apache Solr faceting mechanism, including tasks like getting the number of documents with the same field value, matching the same query, matching given range values, and so on.
Chapter 7, Improving Solr Performance: This chapter will help you troubleshoot performance problems with your Apache Solr instance. Here you will find tips about setting up your Solr instance caches, improving faceting performance, setting up a sharded deployment, or getting the first top documents out of millions fast.
Chapter 8, Creating Applications that Use Solr and Developing your Own Solr Modules: In this chapter, you will learn how to use Solr with different programming languages and how to develop your own modules for Apache Solr server.
Chapter 9, Using Additional Solr Functionalities: In this chapter, you will find recipes that will show you how to use additional Solr components, like the highlighting mechanism, spellchecker, statistics, or grouping mechanism.
Chapter 10, Dealing with Problems: This chapter concentrates on helping you with common problems when running the Apache Solr search server. In this part of the book, you will find recipes that will help you in dealing with a corrupted index, with out-of-memory errors, garbage collection, and so on.
In order to be able to run most of the examples in this book, you will need an Oracle Java Runtime Environment version 1.5 or newer, and of course the 3.1 version of Solr search server.
A few chapters require additional software, such as Apache Nutch 1.2 or your favorite IDE and a Java compiler to be able to edit and compile examples provided in the book.
Developers who are working with Apache Solr and would like to know how to combat common problems will find this book of great use. Knowledge of Apache Lucene would be a bonus, but is not required.
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 are shown as follows: "It's based on the solr.PointType
class and is defined by two attributes."
A block of code is set as follows:
<add> <doc> <field name="id">1</field> <field name="name">Solr cookbook</field> <field name="description">This is a book that I'll show</field> </doc> </add>
When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:
<fieldType name="text_stem" class="solr.TextField">
<analyzer>
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
<filter class="solr.SnowballPorterFilterFactory" />
</analyzer>
</fieldType>
Any command-line input or output is written as follows:
java -jar post.jar ch3_html.xml
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: "If you want to analyze the field type, just type in the appropriate name type and change the name selection to field."
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 <[email protected]>
, and mention the book title via the subject of your message.
If there is a book that you need and would like to see us publish, please send us a note in the SUGGEST A TITLE form on www.packtpub.com or e-mail <[email protected]>
.
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 www.packtpub.com/authors.
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.
You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support 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 http://www.packtpub.com/support, 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 http://www.packtpub.com/support.
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 <[email protected]>
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 <[email protected]>
if you are having a problem with any aspect of the book, and we will do our best to address it.