Skip to content

Commit

Permalink
Update OpensearchQuery docstrings after refactor #267
Browse files Browse the repository at this point in the history
  • Loading branch information
patrick-austin committed Oct 21, 2022
1 parent de47467 commit e91214f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -987,7 +987,7 @@ private void createNestedEntity(OpensearchBulk bulk, String id, String index, Js

if (!document.containsKey(relation.joinField + ".id")) {
throw new IcatException(IcatExceptionType.BAD_PARAMETER,
relation.joinField + ".id not found in " + document.toString());
relation.joinField + ".id not found in " + document);
}

String parentId = document.getString(relation.joinField + ".id");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,8 @@ public static JsonObject buildStringFacet(String field, int maxLabels) {
}

/**
* @param key Arbitrary key
* @param value Arbitrary JsonObjectBuilder
* @param key Arbitrary key
* @param builder Arbitrary JsonObjectBuilder
* @return <code>{`key`: `builder`}}</code>
*/
private static JsonObject build(String key, JsonObjectBuilder builder) {
Expand Down Expand Up @@ -288,8 +288,6 @@ private static long parseDate(JsonObject jsonObject, String key, int offset, lon
* Parses incoming Json encoding the requested facets and uses bodyBuilder to
* construct Json that can be understood by Opensearch.
*
* @param bodyBuilder JsonObjectBuilder being used to build the body of the
* request.
* @param dimensions JsonArray of JsonObjects representing dimensions to be
* faceted.
* @param maxLabels The maximum number of labels to collect for each
Expand All @@ -298,10 +296,8 @@ private static long parseDate(JsonObject jsonObject, String key, int offset, lon
* is needed to distinguish between potentially ambiguous
* dimensions, such as "(investigation.)type.name" and
* "(investigationparameter.)type.name".
* @return The bodyBuilder originally passed with facet information added to it.
*/
public void parseFacets(JsonArray dimensions, int maxLabels,
String dimensionPrefix) {
public void parseFacets(JsonArray dimensions, int maxLabels, String dimensionPrefix) {
JsonObjectBuilder aggsBuilder = Json.createObjectBuilder();
for (JsonObject dimensionObject : dimensions.getValuesAs(JsonObject.class)) {
String dimensionString = dimensionObject.getString("dimension");
Expand All @@ -320,8 +316,6 @@ public void parseFacets(JsonArray dimensions, int maxLabels,
/**
* Uses bodyBuilder to construct Json for faceting string fields.
*
* @param bodyBuilder JsonObjectBuilder being used to build the body of the
* request.
* @param dimensions List of dimensions to perform string based faceting
* on.
* @param maxLabels The maximum number of labels to collect for each
Expand All @@ -330,10 +324,8 @@ public void parseFacets(JsonArray dimensions, int maxLabels,
* is needed to distinguish between potentially ambiguous
* dimensions, such as "(investigation.)type.name" and
* "(investigationparameter.)type.name".
* @return The bodyBuilder originally passed with facet information added to it.
*/
public void parseFacets(List<String> dimensions, int maxLabels,
String dimensionPrefix) {
public void parseFacets(List<String> dimensions, int maxLabels, String dimensionPrefix) {
JsonObjectBuilder aggsBuilder = Json.createObjectBuilder();
for (String dimensionString : dimensions) {
String field = dimensionPrefix == null ? dimensionString : dimensionPrefix + "." + dimensionString;
Expand All @@ -346,14 +338,11 @@ public void parseFacets(List<String> dimensions, int maxLabels,
* Finalises the construction of faceting Json by handling the possibility of
* faceting a nested object.
*
* @param bodyBuilder JsonObjectBuilder being used to build the body of the
* request.
* @param dimensionPrefix Optional prefix to apply to the dimension names. This
* is needed to distinguish between potentially ambiguous
* dimensions, such as "(investigation.)type.name" and
* "(investigationparameter.)type.name".
* @param aggsBuilder JsonObjectBuilder that has the faceting details.
* @return The bodyBuilder originally passed with facet information added to it.
*/
private void buildFacetRequestJson(String dimensionPrefix, JsonObjectBuilder aggsBuilder) {
if (dimensionPrefix == null) {
Expand Down

0 comments on commit e91214f

Please sign in to comment.