I'm writing a custom Solr component. This is how I currently fetch a Solr parameter in the component code:
SolrParams params = rb.req.getParams();
int paramValue = params.getInt(PARAM_NAME, 0);
The above code assigns the integer value of the parameter PARAM_NAME
to the paramValue
variable. The getInt
method tries fetching the value from a GET parameter named PARAM_NAME
sent to Solr via HTTP. If there's no such a GET parameter it fetches it from the defaults
entry of the request handler entry in solrconfig.xml
.
My custom component will be used in several request handlers. Most of the component parameters are common to most of the request handlers. I don't want to configure the common parameters inside each and every such request handler. I have tried defining the common parameters in the defaults
entry of the component entry. Unfortunately, the params.getInt
method doesn't try fetching parameters from the component's defaults
entry, but only from the request handler's defaults
entry.
I need a method that tries fetching a parameter from the component's defaults
entry before trying fetching it from the request handler's defaults
entry.