Skip to content

Apache Lucene open-source search software

allow _version_ to use DocValues

Yonik Seeleyf15097b4e2e8
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 86e0f7e2375..f01ff2d6b68 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -158,6 +158,9 @@ New Features
automatically for an RPT field type. See Spatial4j CHANGES & javadocs.
https://github.com/spatial4j/spatial4j/blob/master/CHANGES.md (David Smiley)
+* SOLR-5670: allow _version_ to use DocValues. (Per Steffensen via 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 c75196e2584..c541ac60e50 100644
--- a/solr/core/src/java/org/apache/solr/update/VersionInfo.java
+++ b/solr/core/src/java/org/apache/solr/update/VersionInfo.java
@@ -49,7 +49,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\" stored=\"true\" and multiValued=\"false\"";
+ final String errPrefix = VERSION_FIELD + " field must exist in schema, using indexed=\"true\" or docValues=\"true\", stored=\"true\" and multiValued=\"false\"";
SchemaField sf = schema.getFieldOrNull(VERSION_FIELD);
if (null == sf) {
@@ -57,10 +57,10 @@ public class VersionInfo {
(SolrException.ErrorCode.SERVER_ERROR,
errPrefix + " (" + VERSION_FIELD + " does not exist)");
}
- if ( !sf.indexed() ) {
+ if ( !sf.indexed() && !sf.hasDocValues()) {
throw new SolrException
(SolrException.ErrorCode.SERVER_ERROR,
- errPrefix + " (" + VERSION_FIELD + " is not indexed");
+ errPrefix + " (" + VERSION_FIELD + " must be either indexed or have docValues");
}
if ( !sf.stored() ) {
throw new SolrException