private void setTopInitArgsAsInvariants ( SolrQueryRequest req ) { // First convert top level initArgs to SolrParams HashMap < String , String > map = new HashMap <> ( initArgs . size ( ) ) ; for ( int i = 0 ; i < initArgs . size ( ) ; i ++ ) { Object val = initArgs . getVal ( i ) ; if ( val != null && ! ( val instanceof NamedList ) ) map . put ( initArgs . getName ( i ) , val . toString ( ) ) ; } if ( map . isEmpty ( ) ) return ; //short circuit; nothing to do SolrParams topInvariants = new MapSolrParams ( map ) ; // By putting putting the top level into the 1st arg, it overrides request params in 2nd arg. req . setParams ( SolrParams . wrapDefaults ( topInvariants , req . getParams ( ) ) ) ; }
This request handler supports configuration options defined at the top level as well as those in typical Solr defaults appends and invariants . The top level ones are treated as invariants .