diff --git a/service/src/main/java/gov/nasa/pds/api/registry/model/WyriwygBusinessObject.java b/service/src/main/java/gov/nasa/pds/api/registry/model/WyriwygBusinessObject.java index 08cdfd48..1f22789b 100644 --- a/service/src/main/java/gov/nasa/pds/api/registry/model/WyriwygBusinessObject.java +++ b/service/src/main/java/gov/nasa/pds/api/registry/model/WyriwygBusinessObject.java @@ -111,7 +111,7 @@ public int setResponse(SearchHits hits, Summary summary, List fields) { WyriwygProductKeyValuePair kvp = new WyriwygProductKeyValuePair(); try { kvp.setKey(SearchUtil.openPropertyToJsonProperty(pair.getKey())); - kvp.setValue(String.valueOf(pair.getValue())); + kvp.setValue(getStringValueOf(pair.getValue())); product.addKeyValuePairsItem(kvp); } catch (UnsupportedSearchProperty e) { log.warn("openSearch property " + pair.getKey() + " is not supported, ignored"); @@ -125,4 +125,21 @@ public int setResponse(SearchHits hits, Summary summary, List fields) { this.products = products; return (int) (hits.getTotalHits().value); } + + private String getStringValueOf(Object o) { + String valueOf; + if (o instanceof Iterable) { + List stringRepresentations = new ArrayList<>(); + for (Object el : (Iterable) o ) { + stringRepresentations.add(String.valueOf(el)); + } + + String delimiter = "|"; + valueOf = String.join(delimiter, stringRepresentations); + } else { + valueOf = String.valueOf(o); + } + + return valueOf; + } }