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
Obtain the default /select request handler to use as a template for the custom /select request handler.
Start Saga
Go to http://localhost/solr/Main/config/requestHandler in the browser. This will list all request handlers.
Find the /select request handler in the response. It will be required in step 3.
Store the following to a file named update.json:
{ "update-requesthandler": { } }
Copy the /select request handler from step 1 and place it inside the "update-requesthandler" section in update.json.
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"] } }
Customize the /select request handler as required. See Solr Request Handlers and Search Components for details.
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' --data-binary @update.json http://localhost/solr/Main/config
The updated /select request handler will be automatically be active (no need to reload). It’s persisted in ZooKeeper:
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' --data-binary @delete.json http://localhost/solr/Main/config
{ "delete-requesthandler": "/select" }