Github user dsmiley commented on a diff in the pull request:
https://github.com/apache/lucene-solr/pull/395#discussion_r194755084
--- 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 --
Any way; lets not increase the scope of this particular issue with my idea
to add this info to the schema. It seems adequate to force the use of an
internal array for a single value in SolrInputField that we know originated
from an array.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]