Cludo Site Search with Java
Also, since there weren’t any working examples using Cludo Site Search with Java API on the net, so decided to build this.
//Get the below Ids from Cludo Dashboard after login String strCustomerId = "xxxx"; String strEngineId = "xxxx"; String strSearchKey = "xxxx"; String url = "https://api.cludo.com/api/v3/" + strCustomerId + "/" + strEngineId + "/search"; //Generate Base64 code String strKeys = strCustomerId + ":" + strEngineId + ":" + strSearchKey; String strBase64SiteKey = "SiteKey " + Base64.getEncoder().encodeToString(strKeys.getBytes());
Getting the Search results:-
JSONArray searchArray = (JSONArray) myresponse.get("TypedDocuments"); JSONObject map = (JSONObject) searchArray.get(0); //You can iterate on JSONArray object to get the list of search results System.out.println(map.get("Score")); System.out.println(map.get("ResultIndex")); System.out.println(myresponse.get("TotalDocument"));
If you’ll debug, you can actually see, the response contains a lot more data like setting priority, manipulating it, etc. Which can be altered to get a targeted and refined result back!