protected when not of the same type mapper when merging

This commit is contained in:
kimchy 2010-07-15 22:35:18 +03:00
parent 9f6fde9adb
commit cf998e2f89
8 changed files with 24 additions and 0 deletions

View File

@ -216,6 +216,9 @@ public class XContentDateFieldMapper extends XContentNumberFieldMapper<Long> {
@Override public void merge(XContentMapper mergeWith, MergeContext mergeContext) throws MergeMappingException {
super.merge(mergeWith, mergeContext);
if (!this.getClass().equals(mergeWith.getClass())) {
return;
}
if (!mergeContext.mergeFlags().simulate()) {
this.nullValue = ((XContentDateFieldMapper) mergeWith).nullValue;
}

View File

@ -198,6 +198,9 @@ public class XContentDoubleFieldMapper extends XContentNumberFieldMapper<Double>
@Override public void merge(XContentMapper mergeWith, MergeContext mergeContext) throws MergeMappingException {
super.merge(mergeWith, mergeContext);
if (!this.getClass().equals(mergeWith.getClass())) {
return;
}
if (!mergeContext.mergeFlags().simulate()) {
this.nullValue = ((XContentDoubleFieldMapper) mergeWith).nullValue;
this.nullValueAsString = ((XContentDoubleFieldMapper) mergeWith).nullValueAsString;

View File

@ -197,6 +197,9 @@ public class XContentFloatFieldMapper extends XContentNumberFieldMapper<Float> {
@Override public void merge(XContentMapper mergeWith, MergeContext mergeContext) throws MergeMappingException {
super.merge(mergeWith, mergeContext);
if (!this.getClass().equals(mergeWith.getClass())) {
return;
}
if (!mergeContext.mergeFlags().simulate()) {
this.nullValue = ((XContentFloatFieldMapper) mergeWith).nullValue;
this.nullValueAsString = ((XContentFloatFieldMapper) mergeWith).nullValueAsString;

View File

@ -197,6 +197,9 @@ public class XContentIntegerFieldMapper extends XContentNumberFieldMapper<Intege
@Override public void merge(XContentMapper mergeWith, MergeContext mergeContext) throws MergeMappingException {
super.merge(mergeWith, mergeContext);
if (!this.getClass().equals(mergeWith.getClass())) {
return;
}
if (!mergeContext.mergeFlags().simulate()) {
this.nullValue = ((XContentIntegerFieldMapper) mergeWith).nullValue;
this.nullValueAsString = ((XContentIntegerFieldMapper) mergeWith).nullValueAsString;

View File

@ -197,6 +197,9 @@ public class XContentLongFieldMapper extends XContentNumberFieldMapper<Long> {
@Override public void merge(XContentMapper mergeWith, MergeContext mergeContext) throws MergeMappingException {
super.merge(mergeWith, mergeContext);
if (!this.getClass().equals(mergeWith.getClass())) {
return;
}
if (!mergeContext.mergeFlags().simulate()) {
this.nullValue = ((XContentLongFieldMapper) mergeWith).nullValue;
this.nullValueAsString = ((XContentLongFieldMapper) mergeWith).nullValueAsString;

View File

@ -159,6 +159,9 @@ public abstract class XContentNumberFieldMapper<T extends Number> extends XConte
@Override public void merge(XContentMapper mergeWith, MergeContext mergeContext) throws MergeMappingException {
super.merge(mergeWith, mergeContext);
if (!this.getClass().equals(mergeWith.getClass())) {
return;
}
if (!mergeContext.mergeFlags().simulate()) {
this.precisionStep = ((XContentNumberFieldMapper) mergeWith).precisionStep;
this.includeInAll = ((XContentNumberFieldMapper) mergeWith).includeInAll;

View File

@ -197,6 +197,9 @@ public class XContentShortFieldMapper extends XContentNumberFieldMapper<Short> {
@Override public void merge(XContentMapper mergeWith, MergeContext mergeContext) throws MergeMappingException {
super.merge(mergeWith, mergeContext);
if (!this.getClass().equals(mergeWith.getClass())) {
return;
}
if (!mergeContext.mergeFlags().simulate()) {
this.nullValue = ((XContentShortFieldMapper) mergeWith).nullValue;
this.nullValueAsString = ((XContentShortFieldMapper) mergeWith).nullValueAsString;

View File

@ -151,6 +151,9 @@ public class XContentStringFieldMapper extends XContentFieldMapper<String> imple
@Override public void merge(XContentMapper mergeWith, MergeContext mergeContext) throws MergeMappingException {
super.merge(mergeWith, mergeContext);
if (!this.getClass().equals(mergeWith.getClass())) {
return;
}
if (!mergeContext.mergeFlags().simulate()) {
this.includeInAll = ((XContentStringFieldMapper) mergeWith).includeInAll;
this.nullValue = ((XContentStringFieldMapper) mergeWith).nullValue;