Internal: Removing unused methods/parameters.

Close #7474
This commit is contained in:
Cristiano Fontes 2014-08-27 15:45:32 +08:00 committed by Adrien Grand
parent 53ce7ad764
commit df5d22c7d7
9 changed files with 11 additions and 40 deletions

View File

@ -170,7 +170,7 @@ public class CompletionFieldMapper extends AbstractFieldMapper<String> {
} else if (Fields.MAX_INPUT_LENGTH.match(fieldName)) { } else if (Fields.MAX_INPUT_LENGTH.match(fieldName)) {
builder.maxInputLength(Integer.parseInt(fieldNode.toString())); builder.maxInputLength(Integer.parseInt(fieldNode.toString()));
} else if ("fields".equals(fieldName) || "path".equals(fieldName)) { } else if ("fields".equals(fieldName) || "path".equals(fieldName)) {
parseMultiField(builder, name, node, parserContext, fieldName, fieldNode); parseMultiField(builder, name, parserContext, fieldName, fieldNode);
} else if (fieldName.equals(Fields.CONTEXT)) { } else if (fieldName.equals(Fields.CONTEXT)) {
builder.contextMapping(ContextBuilder.loadMappings(fieldNode)); builder.contextMapping(ContextBuilder.loadMappings(fieldNode));
} else { } else {

View File

@ -153,7 +153,7 @@ public class DateFieldMapper extends NumberFieldMapper<Long> {
if (propName.equals("null_value")) { if (propName.equals("null_value")) {
builder.nullValue(propNode.toString()); builder.nullValue(propNode.toString());
} else if (propName.equals("format")) { } else if (propName.equals("format")) {
builder.dateTimeFormatter(parseDateTimeFormatter(propName, propNode)); builder.dateTimeFormatter(parseDateTimeFormatter(propNode));
} else if (propName.equals("numeric_resolution")) { } else if (propName.equals("numeric_resolution")) {
builder.timeUnit(TimeUnit.valueOf(propNode.toString().toUpperCase(Locale.ROOT))); builder.timeUnit(TimeUnit.valueOf(propNode.toString().toUpperCase(Locale.ROOT)));
} else if (propName.equals("locale")) { } else if (propName.equals("locale")) {

View File

@ -178,7 +178,7 @@ public class StringFieldMapper extends AbstractFieldMapper<String> implements Al
} else if (propName.equals("ignore_above")) { } else if (propName.equals("ignore_above")) {
builder.ignoreAbove(XContentMapValues.nodeIntegerValue(propNode, -1)); builder.ignoreAbove(XContentMapValues.nodeIntegerValue(propNode, -1));
} else { } else {
parseMultiField(builder, name, node, parserContext, propName, propNode); parseMultiField(builder, name, parserContext, propName, propNode);
} }
} }
return builder; return builder;

View File

@ -154,7 +154,7 @@ public class TypeParsers {
} else if (propName.equals("similarity")) { } else if (propName.equals("similarity")) {
builder.similarity(parserContext.similarityLookupService().similarity(propNode.toString())); builder.similarity(parserContext.similarityLookupService().similarity(propNode.toString()));
} else { } else {
parseMultiField(builder, name, numberNode, parserContext, propName, propNode); parseMultiField(builder, name, parserContext, propName, propNode);
} }
} }
} }
@ -245,7 +245,7 @@ public class TypeParsers {
} }
} }
public static void parseMultiField(AbstractFieldMapper.Builder builder, String name, Map<String, Object> node, Mapper.TypeParser.ParserContext parserContext, String propName, Object propNode) { public static void parseMultiField(AbstractFieldMapper.Builder builder, String name, Mapper.TypeParser.ParserContext parserContext, String propName, Object propNode) {
if (propName.equals("path")) { if (propName.equals("path")) {
builder.multiFieldPathType(parsePathType(name, propNode.toString())); builder.multiFieldPathType(parsePathType(name, propNode.toString()));
} else if (propName.equals("fields")) { } else if (propName.equals("fields")) {
@ -301,7 +301,7 @@ public class TypeParsers {
} }
} }
public static FormatDateTimeFormatter parseDateTimeFormatter(String fieldName, Object node) { public static FormatDateTimeFormatter parseDateTimeFormatter(Object node) {
return Joda.forPattern(node.toString()); return Joda.forPattern(node.toString());
} }
@ -345,16 +345,6 @@ public class TypeParsers {
} }
} }
public static boolean parseDocValues(String docValues) {
if ("no".equals(docValues)) {
return false;
} else if ("yes".equals(docValues)) {
return true;
} else {
return nodeBooleanValue(docValues);
}
}
public static boolean parseStore(String fieldName, String store) throws MapperParsingException { public static boolean parseStore(String fieldName, String store) throws MapperParsingException {
if ("no".equals(store)) { if ("no".equals(store)) {
return false; return false;

View File

@ -245,7 +245,7 @@ public class GeoPointFieldMapper extends AbstractFieldMapper<GeoPoint> implement
} else if (fieldName.equals("normalize_lon")) { } else if (fieldName.equals("normalize_lon")) {
builder.normalizeLon = XContentMapValues.nodeBooleanValue(fieldNode); builder.normalizeLon = XContentMapValues.nodeBooleanValue(fieldNode);
} else { } else {
parseMultiField(builder, name, node, parserContext, fieldName, fieldNode); parseMultiField(builder, name, parserContext, fieldName, fieldNode);
} }
} }
return builder; return builder;

View File

@ -130,7 +130,7 @@ public class TimestampFieldMapper extends DateFieldMapper implements InternalMap
} else if (fieldName.equals("path")) { } else if (fieldName.equals("path")) {
builder.path(fieldNode.toString()); builder.path(fieldNode.toString());
} else if (fieldName.equals("format")) { } else if (fieldName.equals("format")) {
builder.dateTimeFormatter(parseDateTimeFormatter(builder.name(), fieldNode.toString())); builder.dateTimeFormatter(parseDateTimeFormatter(fieldNode.toString()));
} else if (fieldName.equals("default")) { } else if (fieldName.equals("default")) {
builder.defaultTimestamp(fieldNode == null ? null : fieldNode.toString()); builder.defaultTimestamp(fieldNode == null ? null : fieldNode.toString());
} }

View File

@ -422,10 +422,6 @@ public class ObjectMapper implements Mapper, AllFieldMapper.IncludeInAll {
return this.fullPath; return this.fullPath;
} }
public BytesRef nestedTypePathAsBytes() {
return nestedTypePathAsBytes;
}
public String nestedTypePathAsString() { public String nestedTypePathAsString() {
return nestedTypePathAsString; return nestedTypePathAsString;
} }
@ -798,21 +794,6 @@ public class ObjectMapper implements Mapper, AllFieldMapper.IncludeInAll {
} }
} }
} }
// DON'T do automatic ip detection logic, since it messes up with docs that have hosts and ips
// check if its an ip
// if (!resolved && text.indexOf('.') != -1) {
// try {
// IpFieldMapper.ipToLong(text);
// XContentMapper.Builder builder = context.root().findTemplateBuilder(context, currentFieldName, "ip");
// if (builder == null) {
// builder = ipField(currentFieldName);
// }
// mapper = builder.build(builderContext);
// resolved = true;
// } catch (Exception e) {
// // failure to parse, not ip...
// }
// }
if (!resolved) { if (!resolved) {
Mapper.Builder builder = context.root().findTemplateBuilder(context, currentFieldName, "string"); Mapper.Builder builder = context.root().findTemplateBuilder(context, currentFieldName, "string");
if (builder == null) { if (builder == null) {

View File

@ -146,12 +146,12 @@ public class RootObjectMapper extends ObjectMapper {
List<FormatDateTimeFormatter> dateTimeFormatters = newArrayList(); List<FormatDateTimeFormatter> dateTimeFormatters = newArrayList();
if (fieldNode instanceof List) { if (fieldNode instanceof List) {
for (Object node1 : (List) fieldNode) { for (Object node1 : (List) fieldNode) {
dateTimeFormatters.add(parseDateTimeFormatter(fieldName, node1)); dateTimeFormatters.add(parseDateTimeFormatter(node1));
} }
} else if ("none".equals(fieldNode.toString())) { } else if ("none".equals(fieldNode.toString())) {
dateTimeFormatters = null; dateTimeFormatters = null;
} else { } else {
dateTimeFormatters.add(parseDateTimeFormatter(fieldName, fieldNode)); dateTimeFormatters.add(parseDateTimeFormatter(fieldNode));
} }
if (dateTimeFormatters == null) { if (dateTimeFormatters == null) {
((Builder) builder).noDynamicDateTimeFormatter(); ((Builder) builder).noDynamicDateTimeFormatter();

View File

@ -131,7 +131,7 @@ public class ExternalMapper extends AbstractFieldMapper<Object> {
String propName = Strings.toUnderscoreCase(entry.getKey()); String propName = Strings.toUnderscoreCase(entry.getKey());
Object propNode = entry.getValue(); Object propNode = entry.getValue();
parseMultiField(builder, name, node, parserContext, propName, propNode); parseMultiField(builder, name, parserContext, propName, propNode);
} }
return builder; return builder;