From 8c84f5a70430421de57732f0c21ab08bd3de413a Mon Sep 17 00:00:00 2001 From: Ryan Ernst Date: Tue, 7 Jul 2015 07:54:33 -0700 Subject: [PATCH] Fix compile --- .../mapper/attachment/AttachmentMapper.java | 49 +++++++------------ 1 file changed, 17 insertions(+), 32 deletions(-) diff --git a/src/main/java/org/elasticsearch/index/mapper/attachment/AttachmentMapper.java b/src/main/java/org/elasticsearch/index/mapper/attachment/AttachmentMapper.java index f54921a99de..3e1b5a0dcf1 100644 --- a/src/main/java/org/elasticsearch/index/mapper/attachment/AttachmentMapper.java +++ b/src/main/java/org/elasticsearch/index/mapper/attachment/AttachmentMapper.java @@ -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());