Hi All,
I have a CGI task in my worklfow and it is calling search API and comes back to view(.jsp) with the search result.
Sometimes the task is throwing "502 bad gateway error" and sometimes it is giving the search result. But we do not find any error/exception in .java file.
Please find the below lines of code that used for search.
public SearchResults[] search(int taskID, String searchString,String caseSenitive){
if(csClient!=null){
try {
CSSearchEngine searchEngine = csClient.getSearchEngine();
CSTask csTask = csClient.getTask(taskID);
if(caseSenitive!=null&&caseSenitive.equals("true")){
caseSensitive = "~";
csTask.getWorkflow().setVariable("CaseSensitive","true");
}else{
caseSensitive = "";
csTask.getWorkflow().setVariable("CaseSensitive","false");
}
if(csTask!=null){
CSConstraint searchQuery = new CSAndConstraint(new CSConstraint[] {
new CSPhraseConstraint(caseSensitive+searchString)});
System.out.println("searchQuery: " + searchQuery);
System.out.println("Area:"+csTask.getArea().getVPath().toString()+" Area name:"+csTask.getArea().getVPath().getAreaName());
CSArea[] searchAreas = new CSArea[]{csTask.getArea()};
CSIterator it = searchEngine.search(searchAreas, searchQuery);
System.out.println("it: " + it+" and Iterator size:"+it.getTotalSize()); We process the iterator and then we send the search result back to .jsp.
Can you please provide if there are any inputs why it is throwing the 502 badgateway error?