dsmiley commented on code in PR #5298:
URL: https://github.com/apache/solr/pull/5298#discussion_r4520691406


##########
changelog/unreleased/SOLR-18608-glob-rtg-prefetch.yml:
##########
@@ -0,0 +1,7 @@
+title: Honor glob field selection in real-time get and lazy document prefetch
+type: fixed

Review Comment:
   I doubt a user will experience this as a bug fix.  This is a minor 
optimization.  We use "changed" for optimizaitons.



##########
solr/core/src/java/org/apache/solr/search/SolrDocumentFetcher.java:
##########
@@ -769,6 +769,62 @@ public Set<String> getNonStoredDVsWithoutCopyTargets() {
     return nonStoredDVsWithoutCopyTargets;
   }
 
+  /**
+   * Returns the stored fields selected by the response and its transformers, 
before DocValues
+   * substitution. A null result means all stored fields; otherwise the 
returned set is mutable.
+   */
+  public Set<String> getStoredFieldsToLoad(ReturnFields returnFields) {

Review Comment:
   You renamed from `calcStoredFieldsForReturn` then you re-ordered where this 
~big method appears.  I'm okay with the new name but can you put it back?  
(source history value)



##########
solr/core/src/java/org/apache/solr/util/SolrPluginUtils.java:
##########
@@ -229,13 +229,14 @@ public static void optimizePreFetchDocs(
     }
 
     ReturnFields returnFields = res.getReturnFields();
-    if (returnFields.getLuceneFieldNames() != null) {
-      Set<String> fieldFilter = returnFields.getLuceneFieldNames();
-
+    if (returnFields.getLuceneFieldNames() == null && 
!returnFields.hasPatternMatching()) {

Review Comment:
   why is pattern matching relevant?  I suppose this check could be removed 
entirely since I suppose the code you added to get `fieldFilter` would return 
nothing.



##########
solr/core/src/java/org/apache/solr/handler/component/RealTimeGetComponent.java:
##########
@@ -348,8 +348,10 @@ public void process(ResponseBuilder rb) throws IOException 
{
 
         SolrDocumentFetcher docFetcher = 
searcherInfo.getSearcher().getDocFetcher();
         Document luceneDocument =
-            docFetcher.doc(docid, rsp.getReturnFields().getLuceneFieldNames());
-        SolrDocument doc = toSolrDoc(luceneDocument, 
searcherInfo.getSearcher().getSchema());
+            docFetcher.doc(docid, 
docFetcher.getStoredFieldsToLoad(rsp.getReturnFields()));
+        SolrDocument doc =
+            toSolrDoc(
+                luceneDocument, searcherInfo.getSearcher().getSchema(), 
rsp.getReturnFields());

Review Comment:
   Since we used `getStoredFieldsToLoad` above (which uses ReturnFields), why 
do we then also need to pass returnFields here to be used to filter *out* a 
field that was loaded?  In what case would the former return a field the latter 
doesn't?



##########
solr/core/src/java/org/apache/solr/util/SolrPluginUtils.java:
##########
@@ -248,8 +249,11 @@ public static void optimizePreFetchDocs(
         if (null != keyField) fieldFilter.add(keyField.getName());
       }
 
+      if (returnFields.hasPatternMatching() && fieldFilter.isEmpty()) {
+        return;
+      }

Review Comment:
   The request wants only a glob; no explicit field names.  Why can't we 
support this?



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