import java.io.IOException;
import oracle.stellent.ridc.IdcClient;
import oracle.stellent.ridc.IdcClientException;
import oracle.stellent.ridc.IdcClientManager;
import oracle.stellent.ridc.IdcContext;
import oracle.stellent.ridc.model.DataBinder;
import oracle.stellent.ridc.model.DataObject;
import oracle.stellent.ridc.model.DataResultSet;
import oracle.stellent.ridc.model.serialize.HdaBinderSerializer;
import oracle.stellent.ridc.protocol.ServiceResponse;
public class TestRIDCSearch {
public static void main(String[] args) {
IdcClientManager manager = new IdcClientManager();
try {
IdcClient idcClient = manager.createClient("idc://localhost:4444");
IdcContext userContext = new IdcContext("sysadmin");
HdaBinderSerializer serializer = new HdaBinderSerializer("UTF-8", idcClient.getDataFactory());
DataBinder dataBinder = idcClient.createBinder();
dataBinder.putLocal("IdcService", "GET_SEARCH_RESULTS");
/*The easiest way to figure out the QueryText expected by the content server is to execute the query using the content server search screen
in the native UI and trace that call. Gather full verbose, system audit trace using the following trace sections:
system, requestaudit, searchquery, searchcache
This should be the following output:
>searchquery/6 03.25 14:24:41.285 IdcServer-826 preparedQueryText: ( dDocName `test` dSecurityGroup `Public` dInDate >= `3/25/15 12:00 AM` )*/
/*NOTE: UCM limits the ResultCount value according to the MaxResults configuration setting for Content Server.
* To increase the MaxResults setting, add the setting MaxResults=<integer> in config.cfg*/
dataBinder.putLocal("QueryText", "dDocName `test` dSecurityGroup `Public` dInDate >= `3/25/15 12:00 AM`");
serializer.serializeBinder(System.out, dataBinder);
ServiceResponse response = idcClient.sendRequest(userContext, dataBinder);
DataBinder responseData = response.getResponseAsBinder();
serializer.serializeBinder(System.out, responseData);
DataResultSet resultSet = responseData.getResultSet("SearchResults");
for (DataObject dataObject : resultSet.getRows()) {
System.out.println("Title is: " + dataObject.get("dDocTitle"));
}
} catch (IdcClientException ice) {
ice.printStackTrace();
} catch (IOException ioe) {
ioe.printStackTrace();
}
}
}
Monday, October 26, 2015
UCM: GET_SEARCH_RESULTS using RIDC
Labels:
RIDC
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment