@ SuppressWarnings ( "unchecked" ) private static void getParamsFromJSON ( Map < String , String > params , String json ) { JSONParser parser = new JSONParser ( json ) ; try { Object o = ObjectBuilder . getVal ( parser ) ; if ( ! ( o instanceof Map ) ) return ; Map < String , Object > map = ( Map < String , Object > ) o ; // To make consistent with json.param handling, we should make query // params come after json params (i.e. query params should // appear to overwrite json params. // Solr params are based on String though, so we need to convert for ( Map . Entry < String , Object > entry : map . entrySet ( ) ) { String key = entry . getKey ( ) ; Object val = entry . getValue ( ) ; if ( params . get ( key ) != null ) { continue ; } if ( val == null ) { params . remove ( key ) ; } else if ( val instanceof String ) { params . put ( key , ( String ) val ) ; } } } catch ( Exception e ) { log . debug ( "ignore parse exceptions at this stage, they may be caused by incomplete macro expansions" , e ) ; return ; } }
Gets the params from JSON .