epugh commented on code in PR #4203:
URL: https://github.com/apache/solr/pull/4203#discussion_r2910814331


##########
solr/core/src/java/org/apache/solr/handler/designer/SchemaDesignerAPI.java:
##########
@@ -775,38 +808,53 @@ public void query(SolrQueryRequest req, SolrQueryResponse 
rsp)
           version,
           currentVersion);
       List<SolrInputDocument> docs = 
configSetHelper.retrieveSampleDocs(configSet);
-      ManagedIndexSchema schema = loadLatestSchema(mutableId);
-      errorsDuringIndexing =
-          indexSampleDocsWithRebuildOnAnalysisError(
-              schema.getUniqueKeyField().getName(), docs, mutableId, true, 
null);
-      // the version changes when you index (due to field guessing URP)
-      currentVersion = configSetHelper.getCurrentSchemaVersion(mutableId);
+      if (!docs.isEmpty()) {
+        ManagedIndexSchema schema = loadLatestSchema(mutableId);
+        errorsDuringIndexing =
+            indexSampleDocsWithRebuildOnAnalysisError(
+                schema.getUniqueKeyField().getName(), docs, mutableId, true, 
null);
+        // the version changes when you index (due to field guessing URP)
+        currentVersion = configSetHelper.getCurrentSchemaVersion(mutableId);
+      }
       indexedVersion.put(mutableId, currentVersion);
     }
 
     if (errorsDuringIndexing != null) {
-      Map<String, Object> response = new HashMap<>();
-      rsp.setException(
-          new SolrException(
-              SolrException.ErrorCode.BAD_REQUEST,
-              "Failed to re-index sample documents after schema updated."));
-      response.put(ERROR_DETAILS, errorsDuringIndexing);
-      rsp.getValues().addAll(response);
-      return;
+      throw new SolrException(
+          SolrException.ErrorCode.BAD_REQUEST,
+          "Failed to re-index sample documents after schema updated.");
     }

Review Comment:
   Thanks, I dug in and found some bugs and fixed them in how we surface 
errors.  
   <img width="549" height="379" alt="image" 
src="https://github.com/user-attachments/assets/7e3d001f-d962-44bd-b5bb-c22e158f3925";
 />
   



-- 
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