alessandrobenedetti commented on code in PR #4748:
URL: https://github.com/apache/solr/pull/4748#discussion_r3861262371


##########
solr/core/src/java/org/apache/solr/update/processor/NestedUpdateProcessorFactory.java:
##########
@@ -78,87 +79,128 @@ private static class NestedUpdateProcessor extends 
UpdateRequestProcessor {
       this.storePath = storePath;
       this.uniqueKeyFieldName = req.getSchema().getUniqueKeyField().getName();
       this.schema = req.getSchema();
+      this.hasMultiValuedVectorField = hasMultiValuedVectorField(schema);
+    }
+
+    /** Whether any field, explicit or dynamic, could yield vectors to split 
into nested docs. */
+    private static boolean hasMultiValuedVectorField(IndexSchema schema) {
+      for (SchemaField field : schema.getFields().values()) {
+        if (isMultiValuedVectorField(field)) {
+          return true;
+        }
+      }
+      for (IndexSchema.DynamicField dynamicField : schema.getDynamicFields()) {
+        if (isMultiValuedVectorField(dynamicField.getPrototype())) {
+          return true;
+        }
+      }
+      return false;
+    }
+
+    private static boolean isMultiValuedVectorField(SchemaField sfield) {
+      return sfield.getType() instanceof DenseVectorField && 
sfield.multiValued();
     }
 
     @Override
     public void processAdd(AddUpdateCommand cmd) throws IOException {
       SolrInputDocument doc = cmd.getSolrInputDocument();
-      processDocChildren(doc, null);
+      final String rootPath = rootPathPrefix(doc);
+      processDocChildren(doc, rootPath);
+      if (hasMultiValuedVectorField) {
+        // after the children; the docs it generates must not be walked as 
children themselves
+        processMultiValuedVectorFields(doc, rootPath);
+      }

Review Comment:
   Hi David, I agree with the refactor, but It seems the pull request has been 
closed with no merge, nor I can see a link to new separate pull requests? 
ideally I would like to see two pull requests, but If you want to do it all in 
once, I reckon is small enough to do it.
   Let me know!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to