add explicit internal methods for getting doc fields

This commit is contained in:
kimchy 2011-01-30 00:34:50 +02:00
parent ad4bb464e8
commit e5db3175fb
1 changed files with 10 additions and 0 deletions

View File

@ -24,7 +24,9 @@ import org.elasticsearch.ElasticSearchException;
import org.elasticsearch.ElasticSearchIllegalArgumentException;
import org.elasticsearch.common.collect.Maps;
import org.elasticsearch.index.cache.field.data.FieldDataCache;
import org.elasticsearch.index.field.data.DocFieldData;
import org.elasticsearch.index.field.data.FieldData;
import org.elasticsearch.index.field.data.NumericDocFieldData;
import org.elasticsearch.index.mapper.FieldMapper;
import org.elasticsearch.index.mapper.MapperService;
@ -66,6 +68,14 @@ public class DocLookup implements Map {
this.docId = docId;
}
public <T extends DocFieldData> T field(String key) {
return (T) get(key);
}
public <T extends NumericDocFieldData> T numeric(String key) {
return (T) get(key);
}
@Override public Object get(Object key) {
// assume its a string...
String fieldName = key.toString();