try {
JSONObject customImageMetadataJson = new JSONObject(customImageMetadata);
text = new JSONObject(customImageMetadataJson.get("description").toString()).get("_content") +
"\n" + customImageMetadataJson.get("tags").toString();
StreamingPropertyValue textValue = new StreamingPropertyValue(new ByteArrayInputStream(text.getBytes(charset)), String.class);
LumifyProperties.TEXT.addPropertyValue(m, MULTI_VALUE_KEY, textValue, textMetadata, data.getVisibility());
Date lastupdate = GenericDateExtractor
.extractSingleDate(customImageMetadataJson.get("lastupdate").toString());
LumifyProperties.CREATE_DATE.addPropertyValue(m, MULTI_VALUE_KEY, lastupdate, data.createPropertyMetadata(), data.getVisibility());
// TODO set("retrievalTime", Long.parseLong(customImageMetadataJson.get("atc:retrieval-timestamp").toString()));
Map<String, Object> titleMetadata = data.createPropertyMetadata();
LumifyProperties.CONFIDENCE.setMetadata(titleMetadata, 0.4);
LumifyProperties.TITLE.addPropertyValue(m, MULTI_VALUE_KEY, customImageMetadataJson.get("title").toString(), titleMetadata, data.getVisibility());
} catch (JSONException e) {
LOGGER.warn("Image returned invalid custom metadata");
}
} else {
StreamingPropertyValue textValue = new StreamingPropertyValue(new ByteArrayInputStream(text.getBytes(charset)), String.class);
LumifyProperties.TEXT.addPropertyValue(m, MULTI_VALUE_KEY, textValue, textMetadata, data.getVisibility());
LumifyProperties.CREATE_DATE.addPropertyValue(m, MULTI_VALUE_KEY, extractDate(metadata), data.createPropertyMetadata(), data.getVisibility());
String title = extractTextField(metadata, subjectKeys).replaceAll(",", " ");
if (title != null && title.length() > 0) {