You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by ma...@apache.org on 2024/06/26 23:54:25 UTC

(solr) branch main updated: SOLR-17349: SolrDocumentFetcher should always skip lazy field loading overhead if documentCache==null (#2535)

This is an automated email from the ASF dual-hosted git repository.

magibney pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr.git


The following commit(s) were added to refs/heads/main by this push:
     new 390c30ff56a SOLR-17349: SolrDocumentFetcher should always skip lazy field loading overhead if documentCache==null (#2535)
390c30ff56a is described below

commit 390c30ff56ad354a6ee55eaae54713dd8ec4cce3
Author: Michael Gibney <mi...@michaelgibney.net>
AuthorDate: Wed Jun 26 19:54:20 2024 -0400

    SOLR-17349: SolrDocumentFetcher should always skip lazy field loading overhead if documentCache==null (#2535)
---
 solr/CHANGES.txt                                             |  2 ++
 .../src/java/org/apache/solr/search/SolrDocumentFetcher.java | 12 +++++++++---
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 26a88337aac..6c89c9867ee 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -150,6 +150,8 @@ Optimizations
   stored field state, reducing heap usage especially for high-core-count, high-field-count, high-thread-count
   cases (Vinayak Hegde, Christine Poerschke, Kevin Risden, David Smiley, Michael Gibney)
 
+* SOLR-17349: SolrDocumentFetcher should always skip lazy field loading overhead if documentCache==null (Michael Gibney)
+
 Bug Fixes
 ---------------------
 * SOLR-12813: subqueries should respect basic auth. (Rudy Seitz via Eric Pugh)
diff --git a/solr/core/src/java/org/apache/solr/search/SolrDocumentFetcher.java b/solr/core/src/java/org/apache/solr/search/SolrDocumentFetcher.java
index ea7cf854aab..4526d437a6e 100644
--- a/solr/core/src/java/org/apache/solr/search/SolrDocumentFetcher.java
+++ b/solr/core/src/java/org/apache/solr/search/SolrDocumentFetcher.java
@@ -359,9 +359,15 @@ public class SolrDocumentFetcher {
       super(toLoad);
       this.docId = docId;
       this.doc = getDocument();
-      this.lazyFieldProducer =
-          toLoad != null && enableLazyFieldLoading ? new LazyDocument(reader, docId) : null;
-      this.addLargeFieldsLazily = (documentCache != null && !largeFields.isEmpty());
+      if (documentCache == null) {
+        // lazy loading makes no sense if we don't have a `documentCache`
+        this.lazyFieldProducer = null;
+        this.addLargeFieldsLazily = false;
+      } else {
+        this.lazyFieldProducer =
+            toLoad != null && enableLazyFieldLoading ? new LazyDocument(reader, docId) : null;
+        this.addLargeFieldsLazily = !largeFields.isEmpty();
+      }
       // TODO can we return Status.STOP after a val is loaded and we know there are no other fields
       // of interest?
       //    When: toLoad is one single-valued field, no lazyFieldProducer