Skip to content

Commit

Permalink
drop empty check
Browse files Browse the repository at this point in the history
  • Loading branch information
naknomum committed Jan 31, 2025
1 parent 72124f5 commit dee4149
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions src/main/java/org/ecocean/MarkedIndividual.java
Original file line number Diff line number Diff line change
Expand Up @@ -2638,9 +2638,7 @@ public org.json.JSONObject opensearchMapping() {
map.put("timeOfDeath", new org.json.JSONObject("{\"type\": \"date\"}"));
map.put("locationGeoPoints", new org.json.JSONObject("{\"type\": \"geo_point\"}"));

// map.put("nameMap", new org.json.JSONObject("{\"type\": \"nested\"}"));
map.put("nameMap", new org.json.JSONObject("{\"type\": \"nested\", \"dynamic\": false}"));
// map.put("cooccurrenceIndividualMap", new org.json.JSONObject("{\"type\": \"nested\"}"));
map.put("cooccurrenceIndividualMap",
new org.json.JSONObject("{\"type\": \"nested\", \"dynamic\": false}"));
return map;
Expand Down Expand Up @@ -2735,19 +2733,17 @@ relationship partner (name and ID)
dlons.add(dlon);
}
}
if (coMap.size() > 0) {
// json is a quick hacky way to write out using writeRawValue()
// JSONArray coNamesArr = new JSONArray(); TODO unsure how names should be used in index???
org.json.JSONObject coMapJ = new org.json.JSONObject();
jgen.writeArrayFieldStart("cooccurrenceIndividualIds");
for (MarkedIndividual ind : coMap.keySet()) {
jgen.writeString(ind.getId());
coMapJ.put(ind.getId(), coMap.get(ind));
}
jgen.writeEndArray();
jgen.writeFieldName("cooccurrenceIndividualMap");
jgen.writeRawValue(coMapJ.toString());
// json is a quick hacky way to write out using writeRawValue()
// JSONArray coNamesArr = new JSONArray(); TODO unsure how names should be used in index???
org.json.JSONObject coMapJ = new org.json.JSONObject();
jgen.writeArrayFieldStart("cooccurrenceIndividualIds");
for (MarkedIndividual ind : coMap.keySet()) {
jgen.writeString(ind.getId());
coMapJ.put(ind.getId(), coMap.get(ind));
}
jgen.writeEndArray();
jgen.writeFieldName("cooccurrenceIndividualMap");
jgen.writeRawValue(coMapJ.toString());
jgen.writeNumberField("numberMediaAssets", numMAs);

jgen.writeArrayFieldStart("locationGeoPoints");
Expand Down

0 comments on commit dee4149

Please sign in to comment.