Github user merrimanr commented on a diff in the pull request:
https://github.com/apache/metron/pull/995#discussion_r182480647
--- Diff:
metron-platform/metron-solr/src/main/java/org/apache/metron/solr/dao/SolrUpdateDao.java
---
@@ -92,9 +93,17 @@ public void batchUpdate(Map<Document, Optional<String>>
updates) throws IOExcept
}
}
- private SolrInputDocument toSolrInputDocument(Document document) {
+ protected SolrInputDocument toSolrInputDocument(Document document) {
SolrInputDocument solrInputDocument = new SolrInputDocument();
- document.getDocument().forEach(solrInputDocument::addField);
+ document.getDocument().forEach((field, value) -> {
+ if (!isLocationSubField(field)) {
+ solrInputDocument.addField(field, value);
+ }
+ });
return solrInputDocument;
}
+
+ private boolean isLocationSubField(String field) {
+ return field.endsWith(LOCATION_SUB_FIELD_SUFFIX);
--- End diff --
I think there is a better way. Within our schemas there is a "location"
field type that is configured as such:
```
<fieldType name="location" class="solr.LatLonType"
subFieldSuffix="_coordinate"/>
```
The constant in this class matches the "subFieldSuffix" attribute. We
could get column metadata, trace fields back to this type, and remove them
based on the value of the "subFieldSuffix" attribute instead of hardcoding it.
---