Cludo Site SearchNo Comments

Cludo Site Search with Java

Hey Folks! This tutorial is explicitly for those who are using Cludo Site Search in their website, and want to make searches happen programmatically with the help of Java. Trust me on this, the Java API is much more powerful than the default one which works on javascript.
Also, since there weren’t any working examples using Cludo Site Search with Java API on the net, so decided to build this.

git Download the code from GitHub

Example :-

//Get the below Ids from Cludo Dashboard after login
String strCustomerId = "xxxx";
String strEngineId = "xxxx";
String strSearchKey = "xxxx";
String url = "" + 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

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!

Be the first to post a comment.

Add a comment