nick-boss-tech commented on code in PR #5298:
URL: https://github.com/apache/solr/pull/5298#discussion_r4786993877


##########
solr/core/src/java/org/apache/solr/response/transform/DocTransformer.java:
##########
@@ -116,6 +116,15 @@ public String[] getExtraRequestFields() {
     return null;
   }
 
+  /**
+   * Whether index-backed RealTime Get should retain its legacy document 
loading and conversion for
+   * this transformer, because its stored-field dependencies cannot be 
determined in advance. Prefer
+   * declaring dependencies with {@link #getExtraRequestFields()} where 
possible.
+   */
+  public boolean requiresFullDocumentForRTG() {
+    return false;
+  }
+

Review Comment:
   Took this direction: getExtraRequestFields now documents returning exactly 
["*"] in this case, spelled as a DocTransformer.ALL_FIELDS constant that the 
subquery transformer returns, and the FullDocumentTransformer interface is gone.
   
   🤖 *AI-generated text above* 🤖



##########
solr/core/src/java/org/apache/solr/handler/component/RealTimeGetComponent.java:
##########
@@ -906,8 +920,18 @@ private static SolrInputDocument 
toSolrInputDocument(SolrDocument doc, IndexSche
   }
 
   private static SolrDocument toSolrDoc(Document doc, IndexSchema schema) {
+    return toSolrDoc(doc, schema, null);
+  }
+
+  private static SolrDocument toSolrDoc(
+      Document doc, IndexSchema schema, ReturnFields returnFields) {
     SolrDocument out = new SolrDocument();
     for (IndexableField f : doc.getFields()) {
+      // The eager field set does not restrict an existing cache entry, which 
can contain lazy
+      // fields. Keep transformer inputs, but don't materialize unrelated 
fields.
+      if (returnFields != null && !returnFields.loadsField(f.name())) {
+        continue;
+      }

Review Comment:
   Done in the same change: SolrReturnFields carries that state internally, so 
loadsField(name) returns true for every field once a transformer declares 
ALL_FIELDS, and RTG passes returnFields to toSolrDoc unconditionally; the 
useLegacyStoredFields branch is gone.
   
   🤖 *AI-generated text above* 🤖



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