IBM Support

Usage of Class ecm.model.SearchQuery API

Question & Answer


Question

Following the documentation specified at: https://www.ibm.com/support/knowledgecenter/SSEUEX_3.0.1/com.ibm.develo… You may encounter an error "API_PROPERTY_NOT_IN_CACHE: The ClassDescription property was not found in the properties collection."

Cause

The ecm.model.SearchQuery API requires additional parameters, without which you will get errors while attempting to use the API. The required parameters are underlined in the Answer section.

Answer

1) You must provide the repository in the parameters.
2) You must include ClassDescription in the select statement, otherwise you get the "API_PROPERTY_NOT_IN_CACHE: The ClassDescription property was not found in the properties collection." exception.
3) You must include the resultsDisplay parameter, otherwise the search will return the properties configured for repository's search results and otherwise ignore the properties in the select statement.

Example code below:
queryParams.query = "SELECT ClassDescription, DocumentTitle, ContentSize, LastModifier, ID, Creator FROM Document ORDER BY LastModifier";    
         queryParams.retrieveAllVersions = false;                       
         queryParams.retrieveLatestVersion = true;                      
         queryParams.repository = Desktop.repositories[0];
         queryParams.resultsDisplay = {
          "sortBy": "LastModifier","sortAsc": true,
         "columns": ["DocumentTitle", "ContentSize","LastModifier", Creator"],
         "honorNameProperty": true};
var searchQuery = new SearchQuery(queryParams);}                                 
         searchQuery.search(function(response){
console.debug("::response", response);                     
             console.debug("::response", response.getColumns());        
             console.debug("::response.items[0].name", response.items[0].name);
}

[{"Product":{"code":"SSEUEX","label":"IBM Content Navigator"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"ICN and CM Enterprise Edition","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF016","label":"Linux"},{"code":"PF033","label":"Windows"}],"Version":"2.0.3;3.0.0;3.0.1","Edition":"","Line of Business":{"code":"LOB18","label":"Miscellaneous LOB"}}]

Document Information

Modified date:
17 June 2018

UID

swg22007667