private String indexByPythonScript ( DigitalObject object , Payload payload , String confOid , String rulesOid , Properties props ) throws IOException , RuleException { try { JsonSimpleConfig jsonConfig = getConfigFile ( confOid ) ; // Get our data ready Map < String , Object > bindings = new HashMap < String , Object > ( ) ; Map < String , List < String > > fields = new HashMap < String , List < String > > ( ) ; bindings . put ( "fields" , fields ) ; bindings . put ( "jsonConfig" , jsonConfig ) ; bindings . put ( "indexer" , this ) ; bindings . put ( "object" , object ) ; bindings . put ( "payload" , payload ) ; bindings . put ( "params" , props ) ; bindings . put ( "pyUtils" , getPyUtils ( ) ) ; bindings . put ( "log" , log ) ; // Run the data through our script PyObject script = getPythonObject ( rulesOid ) ; if ( script . __findattr__ ( SCRIPT_ACTIVATE_METHOD ) != null ) { script . invoke ( SCRIPT_ACTIVATE_METHOD , Py . java2py ( bindings ) ) ; object . close ( ) ; } else { log . warn ( "Activation method not found!" ) ; } return getPyUtils ( ) . solrDocument ( fields ) ; } catch ( Exception e ) { throw new RuleException ( e ) ; } }
Index a payload using the provided data using a python script