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

Add search criteria using Content Navigator plugin on click of Search Button in Search Template

  • 1.  Add search criteria using Content Navigator plugin on click of Search Button in Search Template

    Posted Wed October 27, 2021 02:04 PM

    In IBM content Navigator, i need to add one additional search criteria to all search template on click of Search button (for example strStatus="In Progress").

    And only documents which matches this criteria should be displayed in search Result.

    This i want to do using IBM content Navigator plugin and this search criteria should not be visible in any search template.

    Can someone help me, how i can archive this?



    #IBMContentNavigator(ICN)
    #Support
    #SupportMigration


  • 2.  RE: Add search criteria using Content Navigator plugin on click of Search Button in Search Template

    Posted Thu October 28, 2021 08:52 AM

    Can you provide the code, if someone has implemented it already



    #IBMContentNavigator(ICN)
    #Support
    #SupportMigration


  • 3.  RE: Add search criteria using Content Navigator plugin on click of Search Button in Search Template

    Posted Tue November 02, 2021 04:24 PM

    We are reviewing this. If there is an available coding option to allow this functionality we will advise within the thread.



    #IBMContentNavigator(ICN)
    #Support
    #SupportMigration


  • 4.  RE: Add search criteria using Content Navigator plugin on click of Search Button in Search Template

    Posted Wed November 03, 2021 10:08 AM

    Hi,

    I have using RequestFilter for /p8/search service and below is the code i am trying, but i am getting error.

    I am not sure if this will work, just referred this link https://github.com/ibm-ecm/ibm-content-navigator-samples/blob/master/UserColumnSettingsPlugin/src/com/ibm/ecm/extension/ColumnsDisplayedRequestFilter.java for an example.




    Code

    JSONObject jsonObj = (JSONObject) jsonRequest;

    JSONArray searchCriteriaArr = (JSONArray) jsonObj.get("searchCriteria");

    JSONArray newCriteria = new JSONArray();

    JSONObject insVal = new JSONObject();

    insVal.put("name", "Document Status");

    insVal.put("values", "In progress");

    insVal.put("defaultOperator", "EQUAL");

    insVal.put("id", "strsStatus");

    insVal.put("selectedOperator", "EQUAL");

    insVal.put("dataType", "xs:string");

    newCriteria.add(insVal);

    jsonObj.put("searchCriteria", newCriteria);

    String criteriaString=jsonObj.toString();

    PluginRequestUtil.setRequestParameter(request,"json_post", criteriaString);



    Error

    com.ibm.ecm.struts.actions.p8.P8SearchAction.executeAction()

    java.lang.ClassCastException: java.lang.String incompatible with com.ibm.json.java.JSONArray

    at com.ibm.ecm.util.SearchCriterion.fromJSON(SearchCriterion.java:202)

    at com.ibm.ecm.util.SearchTemplateBase.fromSearchCriterionJson(SearchTemplateBase.java:158)

    at com.ibm.ecm.util.SearchTemplateBase.fromJSON(SearchTemplateBase.java:143)

    at com.ibm.ecm.util.SearchTemplate.fromJSON(SearchTemplate.java:235)

    at com.ibm.ecm.search.p8.P8SearchTemplate.fromJSON(P8SearchTemplate.java:93)

    at com.ibm.ecm.search.p8.P8SearchTemplateDocument.getSearchTemplate(P8SearchTemplateDocument.java:172)

    at com.ibm.ecm.search.p8.P8SearchTemplateDocumentBase.getSearchTemplate(P8SearchTemplateDocumentBase.java:89)

    at com.ibm.ecm.struts.actions.p8.P8SearchAction.executeAction(P8SearchAction.java:135)



    #IBMContentNavigator(ICN)
    #Support
    #SupportMigration


  • 5.  RE: Add search criteria using Content Navigator plugin on click of Search Button in Search Template

    Posted Tue November 09, 2021 10:32 PM

    Hi, this is from one of the developers:

    Try the following. Note that "values" needs to be an array and that updating the jsonRequest object is sufficient, so there's no need to set "json_post" on the request.

    JSONArray criteria = (JSONArray) ((JSONObject) jsonRequest).get("searchCriteria"); JSONObject criterion = new JSONObject(); JSONArray values = new JSONArray(); values.add("In progress"); criterion.put("id", "strsStatus"); criterion.put("selectedOperator", "EQUAL"); criterion.put("values", values); criterion.put("dataType", "xs:string"); criterion.put("cardinality", "SINGLE"); criteria.add(criterion);



    #IBMContentNavigator(ICN)
    #Support
    #SupportMigration