Chapter 3. Searching Your Data

Once data has been properly indexed, it's definitely time to search! The indexing phase makes no sense if things end there. Data is indexed mainly to speed up and facilitate searches.

This chapter focuses on search capabilities offered by Solr and illustrates the several components that contribute to its read path.

The chapter will cover the following topics:

  • Querying
  • Search configuration
  • The Solr read path: query parsers, search components, request handlers, and response writers
  • Extending Solr
  • Troubleshooting

The sample project

Throughout this chapter, we will use a sample Solr instance with a configuration that includes all the topics we will gradually describe. This instance will have a set of simple documents representing music albums. These are the first three documents:

  <doc>
    <field name="id">1</field>
    <field name="title">A Modern Jazz Symposium of Music and Poetry</field>
    <field name="composer">Charles Mingus</field>
    …
  </doc>
  <doc>
    <field name="id">2</field>
    <field name="title">Where Jazz meets Poetry</field>
    <field name="artist">Raphael Austin</field>
    …
  </doc>
  <doc>
    <field name="id">3</field>
    <field name="title">I'm In The Mood For Love</field>
    <field name="composer">Charlie Parker</field>
    <field name="genre">Jazz</field>
    …
  </doc>

The source code of the sample project associated with this chapter contains the entire Maven project, which can be either loaded in Eclipse or used via the command line. As a preliminary step, open a shell (or run the following command within Eclipse) in the project folder and type this:

# mvn clean cargo:run –P querying

The preceding command will start a new Solr instance, with sample data preloaded.

Tip

The sample data is automatically loaded at startup by means of a custom SolrEventListener. You can find the source code under the org.gazzax.labs.solr.ase.ch3.listener package.

You can use the page located at http://127.0.0.1:8983/solr/#/example/query to try and experiment by yourself the several things we will discuss.

Tip

If you loaded the project in Eclipse, under /src/dev/eclipse you will find the launch configuration used to start Solr.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.217.107.229