Apache Lucene open-source search software
SOLR-8831: allow _version_ field to be retrievable via docValues
yonik50c413e865a1
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex 1d91a3e57ee..bb36297d4ae 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -195,6 +195,8 @@ New Features* SOLR-8698: params.json can now specify 'appends' and 'invariants' (noble)+* SOLR-8831: allow _version_ field to be retrievable via docValues (yonik)+Bug Fixes----------------------diff --git a/solr/core/src/java/org/apache/solr/update/VersionInfo.java b/solr/core/src/java/org/apache/solr/update/VersionInfo.javaindex d5eebec883d..5fe415c6110 100644--- a/solr/core/src/java/org/apache/solr/update/VersionInfo.java+++ b/solr/core/src/java/org/apache/solr/update/VersionInfo.java@@ -61,7 +61,7 @@ public class VersionInfo {*/public static SchemaField getAndCheckVersionField(IndexSchema schema)throws SolrException {- final String errPrefix = VERSION_FIELD + " field must exist in schema, using indexed=\"true\" or docValues=\"true\", stored=\"true\" and multiValued=\"false\"";+ final String errPrefix = VERSION_FIELD + " field must exist in schema and be searchable (indexed or docValues) and retrievable(stored or docValues) and not multiValued";SchemaField sf = schema.getFieldOrNull(VERSION_FIELD);if (null == sf) {@@ -72,12 +72,12 @@ public class VersionInfo {if ( !sf.indexed() && !sf.hasDocValues()) {throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,- errPrefix + " (" + VERSION_FIELD + " must be either indexed or have docValues");+ errPrefix + " (" + VERSION_FIELD + " not searchable");}- if ( !sf.stored() ) {+ if ( !sf.stored() && !sf.hasDocValues()) {throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,- errPrefix + " (" + VERSION_FIELD + " is not stored");+ errPrefix + " (" + VERSION_FIELD + " not retrievable");}if ( sf.multiValued() ) {throw new SolrException