Chapter 5. Indexing


This chapter covers

  • Designing your schema for indexing documents
  • Defining fields and field types in schema.xml
  • Using field types for structured data
  • Handling update requests, commits, and atomic updates
  • Managing index settings in solrconfig.xml

In chapter 3, we learned how Solr finds documents using an inverted index, which in its simplest form is a dictionary of terms and a list of documents in which each term occurs. Solr uses this index to match terms in a user’s query with the documents in which they occur. In this chapter, we’ll learn how Solr processes documents to build the index. A key factor in indexing documents is text analysis. In this chapter, we’ll focus on the indexing process and nontext fields, saving a detailed discussion of text analysis until chapter 6.

At the end of this chapter, you’ll know how to index documents in Solr and you’ll understand key concepts such as fields, field types, and schema design. As a prerequisite, this chapter will be easier to work through if you have the Solr example server running locally, which we covered in chapter 2. You’ll still be able to follow along with most examples without running Solr, if you prefer to read this chapter and then come back to do the hands-on activities.

5.1. Example microblog search application

5.2. Designing your schema

5.3. Defining fields in schema.xml

5.4. Field types for structured nontext fields

5.5. Sending documents to Solr for indexing

5.6. Update handler

5.7. Index management

5.8. Summary