SolrRequestHandler

A [WWW] SolrRequestHandler is a Solr Plugin that defines the logic executed for any request.

  1. Configuration
  2. Handler Resolution
  3. Content Streams
  4. Implementing a Request Handler
  5. List of Request Handlers Available

Configuration

Multiple handlers (including multiple instances of the same SolrRequestHandler class with different configurations) can be specified in the solrconfig.xml

  <requestHandler name="foo" default="true" class="my.package.CustomRequestHandler" />
  <requestHandler name="bar" class="my.package.AnotherCustomRequestHandler" />
    <!-- initialization args may optionally be defined here -->
     <lst name="defaults">
       <int name="rows">10</int>
       <str name="fl">*</str>
       <str name="version">2.1</str>
     <lst>
  </requestHandler>

  <requestHandler name="/baz" class="my.package.AnotherCustomRequestHandler">
  <requestHandler name="/update/my-pdf-reader" class="my.package.MyPdfHandler">

Handler Resolution

Clients access specific SolrRequestHandlers either with the 'qt' parameter on a request for the /select/ url, or through the path registered in solrconfig.xml. For the above example, running on localhost:8983/solr/, you could access:

  http://localhost:8983/solr/select/?qt=foo&...
  http://localhost:8983/solr/select/?qt=bar&...
  http://localhost:8983/solr/baz?...
  http://localhost:8983/solr/update/my-pdf-reader?...

Solr selects a handler to process a request using the following steps...

  1. look for a handler with a name matching the request (either the full path or the "qt")

  2. look for a handler configured with default="true"

  3. look for a handler configured with name="standard"

  4. use an anonymous instance of [WWW] StandardRequestHandler

Note! If your solrconfig.xml contains requestHandlers with the name= "/select", "/update", or "/admin" you will short circuit the standard request processing and use your own logic.

Content Streams

When SolrRequestHandlers are accessed using path based URLs the [WWW] SolrQueryRequest object that contains the parameters of the request may also contain a list of ContentStreams containing bulk data for the request.

Implementing a Request Handler

The easiest way to implement SolrRequestHandler is to extend the [WWW] RequestHandlerBase class. Also see the list of Request Handlers below for examples.

List of Request Handlers Available

The Javadocs contain [WWW] a complete list of Request Handlers. Many of which have their own wiki pages...

last edited 2009-06-24 04:34:33 by NoblePaul