/** * Uses user input fields to perform a search & obtain the COUNT of results for * paging. * @return The number of investigations returned by the search performed. */ int64_t CICatHelper::getNumberOfSearchResults(const CatalogSearchParam &inputs) { ICATPortBindingProxy icat; setICATProxySettings(icat); ns1__searchByAdvanced request; ns1__searchByAdvancedResponse response; std::string sessionID = m_session->getSessionId(); request.sessionId = &sessionID; request.advancedSearchDetails = buildSearchQuery(inputs); int result = icat.searchByAdvanced(&request, &response); int64_t numOfResults = 0; if (result == 0) { numOfResults = response.return_.size(); } else { CErrorHandling::throwErrorMessages(icat); } g_log.debug() << "CICatHelper::getNumberOfSearchResults -> Number of results " "returned is: { " << numOfResults << " }\n"; return numOfResults; }
/* This method calls ICat API searchbydavanced and do the basic run search * @param icat :: Proxy object for ICat * @param request :: request object * @param response :: response object */ int CICatHelper::doSearch(ICATPortBindingProxy& icat,boost::shared_ptr<ns1__searchByAdvanced>& request,ns1__searchByAdvancedResponse& response) { setICATProxySettings(icat); clock_t start=clock(); int ret_advsearch=icat.searchByAdvanced(request.get(),&response); if(ret_advsearch!=0) { CErrorHandling::throwErrorMessages(icat); } clock_t end=clock(); float diff = float(end -start)/CLOCKS_PER_SEC; g_log.information()<<" Time taken to do search is "<<diff<< " seconds "<<std::endl; return ret_advsearch; }