SOLR-13034: RTG sometimes didn't materialize LazyField (#2408)

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.
This commit is contained in:
David Smiley 2021-02-25 16:29:30 -05:00 committed by GitHub
parent 220db76311
commit 62971c4f99
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 3 deletions

View File

@ -260,8 +260,13 @@ Optimizations
Bug 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
---------------------

View File

@ -813,8 +813,9 @@ public class RealTimeGetComponent extends SearchComponent
if ((!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 {

View File

@ -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']");