add a warning for types not to include dots (can't really throw a failure because of it since it will break backward)

This commit is contained in:
kimchy 2011-03-07 19:17:39 +02:00
parent 4bdae621f9
commit 9e2143f343
1 changed files with 3 additions and 0 deletions

View File

@ -153,6 +153,9 @@ public class MapperService extends AbstractIndexComponent implements Iterable<Do
if (mapper.type().contains("#")) { if (mapper.type().contains("#")) {
throw new InvalidTypeNameException("mapping type name [" + mapper.type() + "] should not include '#' in it"); throw new InvalidTypeNameException("mapping type name [" + mapper.type() + "] should not include '#' in it");
} }
if (mapper.type().contains(".")) {
logger.warn("Type [{}] contains a '.', it is recommended not to include it within a type name", mapper.type());
}
remove(mapper.type()); // first remove it (in case its an update, we need to remove the aggregated mappers) remove(mapper.type()); // first remove it (in case its an update, we need to remove the aggregated mappers)
mappers = newMapBuilder(mappers).put(mapper.type(), mapper).immutableMap(); mappers = newMapBuilder(mappers).put(mapper.type(), mapper).immutableMap();
mapper.addFieldMapperListener(fieldMapperListener, true); mapper.addFieldMapperListener(fieldMapperListener, true);