Content Management and Capture

Content Management and Capture

Come for answers. Stay for best practices. All we’re missing is you.

 View Only
Expand all | Collapse all

ICN Response Filter's updated response not reflecting on ICN search result page

  • 1.  ICN Response Filter's updated response not reflecting on ICN search result page

    Posted Tue March 09, 2021 10:50 AM

    Hi,

    I'm new in ICN plugin development. I've developed a response filter which is being invoked on hitting search - "/od/search"

    I've updated the jsonResponse successfully but its not rendering on ICN. Any suggestions are appreciated. Do I have to call filter() anywhere or return jsonResponse?

    Below is the code -

    public void filter(String serverType, PluginServiceCallbacks callbacks, HttpServletRequest request, JSONObject jsonResponse) throws Exception { String repoId = "CMODV10UKUAT"; String templateName=request.getParameter("template_name"); org.json.JSONObject jsonObj=new org.json.JSONObject(jsonResponse.serialize().toString()); try { JSONArray rows=jsonObj.getJSONArray("rows"); server = callbacks.getODServer(repoId); folder = server.openFolder(templateName); for(int i=0;i<rows.length();i++){ docId=rows.getJSONObject(i).getString("opendocid"); System.out.println(docId); hit = folder.recreateHit(docId); fileType = hit.getDisplayValue("File Type"); rows.getJSONObject(i).put("mimetype", "application/pdf"); JSONArray docType=rows.getJSONObject(i).getJSONObject("attributes").getJSONArray("Document Type"); docType.put(0,hit.getDisplayValue("Document Type").toString()+".htm"); } }finally{ folder.close(); } jsonResponse=OrderedJSONObject.parse(jsonObj.toString()); }

    #IBMContentNavigator(ICN)
    #Support
    #SupportMigration


  • 2.  RE: ICN Response Filter's updated response not reflecting on ICN search result page
    Best Answer

    Posted Tue March 09, 2021 02:12 PM

    The issue is resolved now. jsonResponse conversion was causing the issue, do not convert json from 1 type to other (here I've converted to org.json.JSONObject) instead make changes in the same JSON format.



    #IBMContentNavigator(ICN)
    #Support
    #SupportMigration