From 164d6ccd2d4e0a18603bd987ba585fe856c9e0ee Mon Sep 17 00:00:00 2001 From: yonik Date: Fri, 11 Mar 2016 14:10:37 -0500 Subject: [PATCH] SOLR-8831: allow _version_ field to be retrievable via docValues --- solr/CHANGES.txt | 2 ++ .../core/src/java/org/apache/solr/update/VersionInfo.java | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index d43d35cf2be..044cfae4823 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -192,6 +192,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.java index 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