diff --git a/src/main/java/org/icatproject/icat/client/ICAT.java b/src/main/java/org/icatproject/icat/client/ICAT.java index 3aff4ab..7a9667c 100644 --- a/src/main/java/org/icatproject/icat/client/ICAT.java +++ b/src/main/java/org/icatproject/icat/client/ICAT.java @@ -18,6 +18,7 @@ import java.util.Map.Entry; import javax.json.Json; +import javax.json.JsonArray; import javax.json.JsonException; import javax.json.JsonReader; import javax.json.JsonString; @@ -593,8 +594,8 @@ String searchInvestigations(String sessionId, String user, String text, Date low } String searchInvestigations(String sessionId, String user, String text, Date lower, Date upper, - List parameters, List samples, String userFullName, String searchAfter, int limit, String sort, String facets) - throws IcatException { + List parameters, String userFullName, String searchAfter, int maxCount, String sort, + JsonArray facets) throws IcatException { URIBuilder uriBuilder = getUriBuilder("search/documents"); uriBuilder.setParameter("sessionId", sessionId); ByteArrayOutputStream baos = new ByteArrayOutputStream(); @@ -616,24 +617,19 @@ String searchInvestigations(String sessionId, String user, String text, Date low if (parameters != null && !parameters.isEmpty()) { writeParameters(gen, parameters); } - if (samples != null && !samples.isEmpty()) { - gen.writeStartArray("samples"); - for (String sample : samples) { - gen.write(sample); - } - gen.writeEnd(); - } if (userFullName != null) { gen.write("userFullName", userFullName); } + if (facets != null) { + gen.write("facets", facets); + } gen.writeEnd(); } uriBuilder.setParameter("query", baos.toString()); uriBuilder.setParameter("search_after", searchAfter); - uriBuilder.setParameter("limit", Integer.toString(limit)); + uriBuilder.setParameter("maxCount", Integer.toString(maxCount)); uriBuilder.setParameter("sort", sort); - uriBuilder.setParameter("facets", facets); URI uri = getUri(uriBuilder); try (CloseableHttpClient httpclient = HttpClients.createDefault()) { @@ -689,7 +685,7 @@ String searchDatasets(String sessionId, String user, String text, Date lower, Da } String searchDatasets(String sessionId, String user, String text, Date lower, Date upper, - List parameters, String searchAfter, int limit, String sort, String facets) throws IcatException { + List parameters, String searchAfter, int maxCount, String sort, JsonArray facets) throws IcatException { URIBuilder uriBuilder = getUriBuilder("search/documents"); uriBuilder.setParameter("sessionId", sessionId); ByteArrayOutputStream baos = new ByteArrayOutputStream(); @@ -711,14 +707,16 @@ String searchDatasets(String sessionId, String user, String text, Date lower, Da if (parameters != null && !parameters.isEmpty()) { writeParameters(gen, parameters); } + if (facets != null) { + gen.write("facets", facets); + } gen.writeEnd(); } uriBuilder.setParameter("query", baos.toString()); uriBuilder.setParameter("search_after", searchAfter); - uriBuilder.setParameter("limit", Integer.toString(limit)); + uriBuilder.setParameter("maxCount", Integer.toString(maxCount)); uriBuilder.setParameter("sort", sort); - uriBuilder.setParameter("facets", facets); URI uri = getUri(uriBuilder); try (CloseableHttpClient httpclient = HttpClients.createDefault()) { @@ -905,7 +903,7 @@ String searchDatafiles(String sessionId, String user, String text, Date lower, D } String searchDatafiles(String sessionId, String user, String text, Date lower, Date upper, - List parameters, String searchAfter, int limit, String sort, String facets) throws IcatException { + List parameters, String searchAfter, int maxCount, String sort, JsonArray facets) throws IcatException { URIBuilder uriBuilder = getUriBuilder("search/documents"); uriBuilder.setParameter("sessionId", sessionId); ByteArrayOutputStream baos = new ByteArrayOutputStream(); @@ -927,14 +925,16 @@ String searchDatafiles(String sessionId, String user, String text, Date lower, D if (parameters != null && !parameters.isEmpty()) { writeParameters(gen, parameters); } + if (facets != null) { + gen.write("facets", facets); + } gen.writeEnd(); } uriBuilder.setParameter("query", baos.toString()); uriBuilder.setParameter("search_after", searchAfter); - uriBuilder.setParameter("limit", Integer.toString(limit)); + uriBuilder.setParameter("maxCount", Integer.toString(maxCount)); uriBuilder.setParameter("sort", sort); - uriBuilder.setParameter("facets", facets); URI uri = getUri(uriBuilder); try (CloseableHttpClient httpclient = HttpClients.createDefault()) { diff --git a/src/main/java/org/icatproject/icat/client/Session.java b/src/main/java/org/icatproject/icat/client/Session.java index 1f704e7..4abc364 100644 --- a/src/main/java/org/icatproject/icat/client/Session.java +++ b/src/main/java/org/icatproject/icat/client/Session.java @@ -6,6 +6,8 @@ import java.util.List; import java.util.Map; +import javax.json.JsonArray; + /** * A RESTful ICAT session. *

@@ -439,7 +441,7 @@ public String searchInvestigations(String user, String text, Date lower, Date up * String representing the last document of a previous * search, so that results from this search will only * include results from after the document - * @param limit + * @param maxCount * The maximum number of results to return. * @param sort * String representing a JSON object which contains key @@ -458,11 +460,10 @@ public String searchInvestigations(String user, String text, Date lower, Date up * For various ICAT errors. */ public String searchInvestigations(String user, String text, Date lower, Date upper, - List parameters, List samples, String userFullName, String searchAfter, - int limit, String sort, String facets) - throws IcatException { - return icat.searchInvestigations(sessionId, user, text, lower, upper, parameters, samples, userFullName, - searchAfter, limit, sort, facets); + List parameters, String userFullName, String searchAfter, int maxCount, String sort, + JsonArray facets) throws IcatException { + return icat.searchInvestigations(sessionId, user, text, lower, upper, parameters, userFullName, + searchAfter, maxCount, sort, facets); } /** @@ -523,7 +524,7 @@ public String searchDatasets(String user, String text, Date lower, Date upper, L * String representing the last document of a previous * search, so that results from this search will only include * results from after the document - * @param limit + * @param maxCount * The maximum number of results to return. * @param sort * String representing a JSON object which contains key value @@ -541,8 +542,8 @@ public String searchDatasets(String user, String text, Date lower, Date upper, L * For various ICAT errors. */ public String searchDatasets(String user, String text, Date lower, Date upper, List parameters, - String searchAfter, int limit, String sort, String facets) throws IcatException { - return icat.searchDatasets(sessionId, user, text, lower, upper, parameters, searchAfter, limit, sort, facets); + String searchAfter, int maxCount, String sort, JsonArray facets) throws IcatException { + return icat.searchDatasets(sessionId, user, text, lower, upper, parameters, searchAfter, maxCount, sort, facets); } /** @@ -650,7 +651,7 @@ public String searchDatafiles(String user, String text, Date lower, Date upper, * String representing the last document of a previous * search, so that results from this search will only include * results from after the document - * @param limit + * @param maxCount * The maximum number of results to return. * @param sort * String representing a JSON object which contains key value @@ -668,8 +669,8 @@ public String searchDatafiles(String user, String text, Date lower, Date upper, * For various ICAT errors. */ public String searchDatafiles(String user, String text, Date lower, Date upper, List parameters, - String searchAfter, int limit, String sort, String facets) throws IcatException { - return icat.searchDatafiles(sessionId, user, text, lower, upper, parameters, searchAfter, limit, sort, facets); + String searchAfter, int maxCount, String sort, JsonArray facets) throws IcatException { + return icat.searchDatafiles(sessionId, user, text, lower, upper, parameters, searchAfter, maxCount, sort, facets); } /**