SOLR-8831: allow _version_ field to be retrievable via docValues

This commit is contained in:
yonik 2016-03-11 14:10:37 -05:00
parent ef916c1e7e
commit 164d6ccd2d
2 changed files with 6 additions and 4 deletions

View File

@ -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
----------------------

View File

@ -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