denormMediaRecords(session, csid, tenantId, denormValues);
denormAcquisitionRecords(session, csid, tenantId, denormValues);
denormExhibitionRecords(session, csid, tenantId, denormValues);
+ denormMaterialFields(doc, denormValues);
// Compute the title of the record for the public browser, and store it so that it can
// be used for sorting ES query results.
denormValues.putArray("exhibition").addAll(exhibitions);
}
+ /**
+ * Denormalize the material group list for a collectionobject in order to index the controlled or uncontrolled term
+ *
+ * @param doc the collectionobject document
+ * @param denormValues the json node for denormalized fields
+ */
+ private void denormMaterialFields(DocumentModel doc, ObjectNode denormValues) {
+ List<Map<String, Object>> materialGroupList =
+ (List<Map<String, Object>>) doc.getProperty("collectionobjects_common", "materialGroupList");
+
+ List<JsonNode> denormMaterials = new ArrayList<>();
+ for (Map<String, Object> materialGroup : materialGroupList) {
+ String controlledMaterial = (String) materialGroup.get("materialControlled");
+ if (controlledMaterial != null) {
+ final ObjectNode node = objectMapper.createObjectNode();
+ node.put("material", RefNameUtils.getDisplayName(controlledMaterial));
+ denormMaterials.add(node);
+ }
+
+ String material = (String) materialGroup.get("material");
+ if (material != null) {
+ final ObjectNode node = objectMapper.createObjectNode();
+ node.put("material", material);
+ denormMaterials.add(node);
+ }
+ }
+
+ denormValues.putArray("materialGroupList").addAll(denormMaterials);
+ }
+
/**
* Compute a title for the public browser. This needs to be indexed in ES so that it can
* be used for sorting. (Even if it's just extracting the primary value.)
"collectionobjects_common:contentConcepts",
"collectionobjects_common:fieldCollectionDateGroup",
"collectionobjects_common:fieldCollectors",
- "collectionobjects_common:materialGroupList",
"collectionobjects_common:measuredPartGroupList",
"collectionobjects_common:numberOfObjects",
"collectionobjects_common:objectHistoryNote",
}
}
},
+ "collectionspace_denorm:materialGroupList": {
+ "type": "object",
+ "properties": {
+ "material": {
+ "type": "keyword",
+ "copy_to": "all_field"
+ }
+ }
+ },
"collectionobjects_common:objectNumber": {
"type": "keyword",
}
}
},
- "collectionobjects_common:materialGroupList": {
- "type": "object",
- "properties": {
- "material": {
- "type": "keyword",
- "copy_to": "all_field"
- }
- }
- },
"collectionobjects_common:colors": {
"type": "keyword",
"copy_to": "all_field"
"collectionobjects_common:colors",
"collectionobjects_common:computedCurrentLocation",
"collectionobjects_common:contentConcepts",
- "collectionobjects_common:materialGroupList",
"collectionobjects_common:measuredPartGroupList",
"collectionobjects_common:numberOfObjects",
"collectionobjects_common:objectHistoryNote",
}
}
},
+ "collectionspace_denorm:materialGroupList": {
+ "type": "object",
+ "properties": {
+ "material": {
+ "type": "keyword",
+ "copy_to": "all_field"
+ }
+ }
+ },
"collectionobjects_common:objectNumber": {
"type": "keyword",
}
}
},
- "collectionobjects_common:materialGroupList": {
- "type": "object",
- "properties": {
- "material": {
- "type": "keyword",
- "copy_to": "all_field"
- }
- }
- },
"collectionobjects_common:colors": {
"type": "keyword",
"copy_to": "all_field"
"collectionobjects_common:colors",
"collectionobjects_common:computedCurrentLocation",
"collectionobjects_common:contentConcepts",
- "collectionobjects_common:materialGroupList",
"collectionobjects_common:measuredPartGroupList",
"collectionobjects_common:numberOfObjects",
"collectionobjects_common:objectHistoryNote",
}
}
},
+ "collectionspace_denorm:materialGroupList": {
+ "type": "object",
+ "properties": {
+ "material": {
+ "type": "keyword",
+ "copy_to": "all_field"
+ }
+ }
+ },
"collectionobjects_common:objectNumber": {
"type": "keyword",
}
}
},
- "collectionobjects_common:materialGroupList": {
- "type": "object",
- "properties": {
- "material": {
- "type": "keyword",
- "copy_to": "all_field"
- }
- }
- },
"collectionobjects_common:colors": {
"type": "keyword",
"copy_to": "all_field"