When _source is disabled, don't return it in realtime get fetching the document from the transaction log, closes #1509.

This commit is contained in:
Shay Banon 2011-11-29 09:39:46 +02:00
parent e9fe8ec469
commit b2fa6b7a94
1 changed files with 6 additions and 1 deletions

View File

@ -306,7 +306,7 @@ public class ShardGetService extends AbstractIndexShardComponent {
FieldMapper<?> x = docMapper.mappers().smartNameFieldMapper(field);
value = searchLookup.source().extractValue(field);
if (x != null && value instanceof String) {
value = x.valueFromString((String)value);
value = x.valueFromString((String) value);
}
}
}
@ -324,6 +324,11 @@ public class ShardGetService extends AbstractIndexShardComponent {
}
}
// if source is not enabled, don't return it even though we have it from the translog
if (sourceRequested && !docMapper.sourceMapper().enabled()) {
sourceRequested = false;
}
return new GetResult(shardId.index().name(), type, id, get.version(), get.exists(), sourceRequested ? source.source : null, fields);
}
} finally {