Fix compile

This commit is contained in:
Ryan Ernst 2015-07-07 07:54:33 -07:00
parent 1e84dbd32b
commit 8c84f5a704
1 changed files with 17 additions and 32 deletions

View File

@ -75,6 +75,11 @@ public class AttachmentMapper extends AbstractFieldMapper {
public static class Defaults {
public static final ContentPath.Type PATH_TYPE = ContentPath.Type.FULL;
public static final AttachmentFieldType FIELD_TYPE = new AttachmentFieldType();
static {
FIELD_TYPE.freeze();
}
}
public static class FieldNames {
@ -90,9 +95,7 @@ public class AttachmentMapper extends AbstractFieldMapper {
}
static final class AttachmentFieldType extends MappedFieldType {
public AttachmentFieldType() {
super(AbstractFieldMapper.Defaults.FIELD_TYPE);
}
public AttachmentFieldType() {}
protected AttachmentFieldType(AttachmentMapper.AttachmentFieldType ref) {
super(ref);
@ -102,6 +105,11 @@ public class AttachmentMapper extends AbstractFieldMapper {
return new AttachmentMapper.AttachmentFieldType(this);
}
@Override
public String typeName() {
return CONTENT_TYPE;
}
public String value(Object value) {
return value == null?null:value.toString();
}
@ -243,7 +251,7 @@ public class AttachmentMapper extends AbstractFieldMapper {
if (langDetect == null) {
langDetect = Boolean.FALSE;
}
MappedFieldType defaultFieldType = AbstractFieldMapper.Defaults.FIELD_TYPE.clone();
MappedFieldType defaultFieldType = Defaults.FIELD_TYPE.clone();
if(this.fieldType.indexOptions() != IndexOptions.NONE && !this.fieldType.tokenized()) {
defaultFieldType.setOmitNorms(true);
defaultFieldType.setIndexOptions(IndexOptions.DOCS);
@ -258,9 +266,9 @@ public class AttachmentMapper extends AbstractFieldMapper {
defaultFieldType.freeze();
this.setupFieldType(context);
return new AttachmentMapper(this.fieldType, pathType, defaultIndexedChars, ignoreErrors, langDetect, contentMapper,
return new AttachmentMapper(name, fieldType, defaultFieldType, pathType, defaultIndexedChars, ignoreErrors, langDetect, contentMapper,
dateMapper, titleMapper, nameMapper, authorMapper, keywordsMapper, contentTypeMapper, contentLength,
language, this.fieldDataSettings, context.indexSettings(), multiFieldsBuilder.build(this, context), copyTo);
language, context.indexSettings(), multiFieldsBuilder.build(this, context), copyTo);
}
}
@ -402,12 +410,12 @@ public class AttachmentMapper extends AbstractFieldMapper {
private final FieldMapper languageMapper;
public AttachmentMapper(MappedFieldType type, ContentPath.Type pathType, int defaultIndexedChars, Boolean ignoreErrors,
public AttachmentMapper(String simpleName, MappedFieldType type, MappedFieldType defaultFieldType, ContentPath.Type pathType, int defaultIndexedChars, Boolean ignoreErrors,
Boolean defaultLangDetect, FieldMapper contentMapper,
FieldMapper dateMapper, FieldMapper titleMapper, FieldMapper nameMapper, FieldMapper authorMapper,
FieldMapper keywordsMapper, FieldMapper contentTypeMapper, FieldMapper contentLengthMapper,
FieldMapper languageMapper, @Nullable Settings fieldDataSettings, Settings indexSettings, MultiFields multiFields, CopyTo copyTo) {
super(type, false, fieldDataSettings, indexSettings, multiFields, copyTo);
FieldMapper languageMapper, Settings indexSettings, MultiFields multiFields, CopyTo copyTo) {
super(simpleName, type, defaultFieldType, indexSettings, multiFields, copyTo);
this.pathType = pathType;
this.defaultIndexedChars = defaultIndexedChars;
this.ignoreErrors = ignoreErrors;
@ -423,16 +431,6 @@ public class AttachmentMapper extends AbstractFieldMapper {
this.languageMapper = languageMapper;
}
@Override
public MappedFieldType defaultFieldType() {
return AbstractFieldMapper.Defaults.FIELD_TYPE;
}
@Override
public FieldDataType defaultFieldDataType() {
return null;
}
@Override
public Mapper parse(ParseContext context) throws IOException {
byte[] content = null;
@ -649,19 +647,6 @@ public class AttachmentMapper extends AbstractFieldMapper {
return CollectionUtils.concat(super.iterator(), extras.iterator());
}
@Override
public void close() {
contentMapper.close();
dateMapper.close();
titleMapper.close();
nameMapper.close();
authorMapper.close();
keywordsMapper.close();
contentTypeMapper.close();
contentLengthMapper.close();
languageMapper.close();
}
@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
builder.startObject(name());