Apache Solr open-source search software
SOLR-13034: RTG sometimes didn't materialize LazyField (#2408)
David Smiley62971c4f9904
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex f7397d6c470..572406445b9 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -260,8 +260,13 @@ OptimizationsBug Fixes---------------------* SOLR-15078: Fix ExpandComponent behavior when expanding on numeric fields to differentiate '0' group from null group (hossman)+* SOLR-15149: Better exception handling for LTR model creation errors (Alessandro Benedetti, Christine Poerschke)+* SOLR-13034: Partial (AKA Atomic) updates could encounter "LazyField" instances in the document+ cache and not know hot to deal with them when writing the updated doc to the update log.+ (David Smiley)+Other Changes---------------------diff --git a/solr/core/src/java/org/apache/solr/handler/component/RealTimeGetComponent.java b/solr/core/src/java/org/apache/solr/handler/component/RealTimeGetComponent.javaindex ad1483726f8..c5751d36e58 100644--- a/solr/core/src/java/org/apache/solr/handler/component/RealTimeGetComponent.java+++ b/solr/core/src/java/org/apache/solr/handler/component/RealTimeGetComponent.java@@ -813,8 +813,9 @@ public class RealTimeGetComponent extends SearchComponentif ((!sf.hasDocValues() && !sf.stored()) || schema.isCopyFieldTarget(sf)) continue;}for (Object val: doc.getFieldValues(fname)) {- if (val instanceof Field) {- Field f = (Field) val;+ if (val instanceof IndexableField) {+ IndexableField f = (IndexableField) val;+ // materialize:if (sf != null) {val = sf.getType().toObject(f); // object or external string?} else {diff --git a/solr/core/src/test/org/apache/solr/update/processor/AtomicUpdatesTest.java b/solr/core/src/test/org/apache/solr/update/processor/AtomicUpdatesTest.javaindex 3eba2089303..fcedc1f4ecc 100644--- a/solr/core/src/test/org/apache/solr/update/processor/AtomicUpdatesTest.java+++ b/solr/core/src/test/org/apache/solr/update/processor/AtomicUpdatesTest.java@@ -1005,7 +1005,11 @@ public class AtomicUpdatesTest extends SolrTestCaseJ4 {assertU(commit());- assertQ(req("q", "cat:*", "indent", "true"), "//result[@numFound = '2']");+ // note: by requesting only the id, the other field values will be LazyField instances in the+ // document cache.+ // This winds up testing that future fetches by RTG of this doc will handle it properly.+ // See SOLR-13034+ assertQ(req("q", "cat:*", "indent", "true", "fl", "id"), "//result[@numFound = '2']");assertQ(req("q", "cat:bbb", "indent", "true"), "//result[@numFound = '0']");