Github user moshebla commented on a diff in the pull request:
https://github.com/apache/lucene-solr/pull/395#discussion_r194245516
--- Diff: solr/core/src/java/org/apache/solr/handler/loader/JsonLoader.java
---
@@ -668,7 +682,40 @@ private boolean isChildDoc(SolrInputDocument
extendedMap) {
return
extendedMap.containsKey(req.getSchema().getUniqueKeyField().getName());
}
- private SolrInputDocument generateExtendedValueMap(int ev) throws
IOException {
+ private boolean entryIsChildDoc(Object val) {
+ if(val instanceof List) {
+ List listVal = (List) val;
+ if (listVal.size() == 0) return false;
+ return listVal.get(0) instanceof Map;
+ }
+ return val instanceof Map;
+ }
+
+ private void safeAddValue(SolrInputDocument doc, String fieldName,
Object value) {
--- End diff --
I tried the same method, except because SolrInputDocument implements
iterable, each document key is added, instead of the SolrInputDocument object.
This chain of event occurs because
[SolrInputDocument.addField](https://github.com/moshebla/lucene-solr/blob/3c51c1c414c6f7cb359e3ef442ca706e33cf3a7a/solr/solrj/src/java/org/apache/solr/common/SolrInputDocument.java#L84)
calls
[SolrInputField.addValue](https://github.com/moshebla/lucene-solr/blob/3c51c1c414c6f7cb359e3ef442ca706e33cf3a7a/solr/solrj/src/java/org/apache/solr/common/SolrInputField.java#L91).
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]