Github user dsmiley commented on a diff in the pull request: https://github.com/apache/lucene-solr/pull/395#discussion_r194445760 --- Diff: solr/core/src/java/org/apache/solr/handler/loader/JsonLoader.java --- @@ -249,14 +251,27 @@ public void handle(Map<String, Object> record, String path) { private SolrInputDocument buildDoc(Map<String, Object> m) { SolrInputDocument result = new SolrInputDocument(); for (Map.Entry<String, Object> e : m.entrySet()) { - if (e.getKey() == null) {// special case. JsonRecordReader emits child docs with null key + if (entryIsChildDoc(e.getValue())) {// special case. JsonRecordReader emits child docs with null key if (e.getValue() instanceof List) { List value = (List) e.getValue(); for (Object o : value) { - if (o instanceof Map) result.addChildDocument(buildDoc((Map) o)); + if (o instanceof Map) { + if (anonChildDocFlag) { + result.addChildDocument(buildDoc((Map) o)); + } else { + if(!result.containsKey(e.getKey())) { + result.setField(e.getKey(), new ArrayList<>(1)); --- End diff -- ok so you are trying to retain the semantic information that the input was an array (potentially multi-valued) even if the particular input doc only had one value. Maybe say more or that, hinting at why we even care. (why do we care)? For regular field values, we don't at this level -- the schema holds multiValue info so it's dealth with later. Again I'm liking my suggestion of putting a virtual child doc field in the schema as it addresses the desire to know this semantic info, plus I think it may add some consistency (avoids special case you're doing here)
--- --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org