gather the field data that are changed
(we will make use of that later)
This commit is contained in:
parent
98a674fc6e
commit
a39469a252
|
@ -21,6 +21,8 @@ package org.elasticsearch.index.mapper;
|
|||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -35,6 +37,8 @@ public class MergeContext {
|
|||
private final FieldMapperListener.Aggregator newFieldMappers = new FieldMapperListener.Aggregator();
|
||||
private final ObjectMapperListener.Aggregator newObjectMappers = new ObjectMapperListener.Aggregator();
|
||||
|
||||
private List<FieldMapper> fieldDataChanges = null;
|
||||
|
||||
public MergeContext(DocumentMapper documentMapper, DocumentMapper.MergeFlags mergeFlags) {
|
||||
this.documentMapper = documentMapper;
|
||||
this.mergeFlags = mergeFlags;
|
||||
|
@ -67,4 +71,18 @@ public class MergeContext {
|
|||
public String[] buildConflicts() {
|
||||
return mergeConflicts.toArray(new String[mergeConflicts.size()]);
|
||||
}
|
||||
|
||||
public void addFieldDataChange(FieldMapper mapper) {
|
||||
if (fieldDataChanges == null) {
|
||||
fieldDataChanges = new ArrayList<FieldMapper>();
|
||||
}
|
||||
fieldDataChanges.add(mapper);
|
||||
}
|
||||
|
||||
public List<FieldMapper> fieldMapperChanges() {
|
||||
if (fieldDataChanges == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return fieldDataChanges;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
package org.elasticsearch.index.mapper.core;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import org.apache.lucene.analysis.Analyzer;
|
||||
import org.apache.lucene.document.Field;
|
||||
import org.apache.lucene.document.FieldType;
|
||||
|
@ -583,10 +584,13 @@ public abstract class AbstractFieldMapper<T> implements FieldMapper<T>, Mapper {
|
|||
this.postingsFormat = fieldMergeWith.postingsFormat;
|
||||
}
|
||||
if (fieldMergeWith.customFieldDataSettings != null) {
|
||||
if (!Objects.equal(fieldMergeWith.customFieldDataSettings, this.customFieldDataSettings)) {
|
||||
this.customFieldDataSettings = fieldMergeWith.customFieldDataSettings;
|
||||
this.fieldDataType = new FieldDataType(defaultFieldDataType().getType(),
|
||||
ImmutableSettings.builder().put(defaultFieldDataType().getSettings()).put(this.customFieldDataSettings)
|
||||
);
|
||||
mergeContext.addFieldDataChange(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue