Customize the Default Request Handler

Introduction

Saga comes with a Solr configuration well suited for most enterprise search scenarios. However, some cases may require changes to the /select request handler in solrconfig.xml. This is done by using the Solr Config API to create the file configoverlay.json with the changes.

How to Customize the Default Request Handler

  1. Obtain the default /select request handler to use as a template for the custom /select request handler.

    1. Start Saga

    2. Go to http://localhost/solr/Main/config/requestHandler in the browser. This will list all request handlers.

    3. Find the /select request handler in the response. It will be required in step 3.

  2. Store the following to a file named update.json:

    { "update-requesthandler": { } }
  3. Copy the /select request handler from step 1 and place it inside the "update-requesthandler" section in update.json.

  4. The update.json file will look something like we see below. Please note that … in line 7 represents most of the not shown content of the /select request handler.

    { "update-requesthandler": { "name":"/select", "class":"solr.SearchHandler", "defaults":{ "echoParams":"explicit", ... "rows":10 }, "appends":{"fq":["platform_is_container:0","custom_field:0","{!sidvalidate}"]}, "last-components":["elevator","suggest"] } }

     

  5. Customize the /select request handler as required. See Solr Request Handlers and Search Components for details.

  6. Open Command Prompt, cd to the directory that contains update.json and run the following command (requires that curl is installed) :
    curl -X POST -H 'Content-type:application/json' -d @update.json http://localhost/solr/Main/config

  7. The updated /select request handler will be automatically be active (no need to reload). It’s persisted in ZooKeeper:

  8. If one wants to revert back to the default /select request handler, one can store the following in a file named delete.json and run curl -X POST -H 'Content-type:application/json' -d @delete.json http://localhost/solr/Main/config

    { "delete-requesthandler": "/select" }