check "store" for binary mapper and check "index_name" for all mappers
closes #5474
This commit is contained in:
parent
04c16b7ba5
commit
3338750f14
|
@ -123,6 +123,31 @@ public interface FieldMapper<T> extends Mapper {
|
|||
public Term createIndexNameTerm(BytesRef value) {
|
||||
return new Term(indexName, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
Names names = (Names) o;
|
||||
|
||||
if (!fullName.equals(names.fullName)) return false;
|
||||
if (!indexName.equals(names.indexName)) return false;
|
||||
if (!indexNameClean.equals(names.indexNameClean)) return false;
|
||||
if (!name.equals(names.name)) return false;
|
||||
if (!sourcePath.equals(names.sourcePath)) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = name.hashCode();
|
||||
result = 31 * result + indexName.hashCode();
|
||||
result = 31 * result + indexNameClean.hashCode();
|
||||
result = 31 * result + fullName.hashCode();
|
||||
result = 31 * result + sourcePath.hashCode();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
public static enum Loading {
|
||||
|
|
|
@ -606,6 +606,9 @@ public abstract class AbstractFieldMapper<T> implements FieldMapper<T> {
|
|||
} else if (!this.indexAnalyzer.name().equals(fieldMergeWith.indexAnalyzer.name())) {
|
||||
mergeContext.addConflict("mapper [" + names.fullName() + "] has different index_analyzer");
|
||||
}
|
||||
if (!this.names().equals(fieldMergeWith.names())) {
|
||||
mergeContext.addConflict("mapper [" + names.fullName() + "] has different index_name");
|
||||
}
|
||||
|
||||
if (this.similarity == null) {
|
||||
if (fieldMergeWith.similarity() != null) {
|
||||
|
|
|
@ -225,7 +225,25 @@ public class BinaryFieldMapper extends AbstractFieldMapper<BytesReference> {
|
|||
|
||||
@Override
|
||||
public void merge(Mapper mergeWith, MergeContext mergeContext) throws MergeMappingException {
|
||||
if (!(mergeWith instanceof BinaryFieldMapper)) {
|
||||
String mergedType = mergeWith.getClass().getSimpleName();
|
||||
if (mergeWith instanceof AbstractFieldMapper) {
|
||||
mergedType = ((AbstractFieldMapper) mergeWith).contentType();
|
||||
}
|
||||
mergeContext.addConflict("mapper [" + names.fullName() + "] of different type, current_type [" + contentType() + "], merged_type [" + mergedType + "]");
|
||||
// different types, return
|
||||
return;
|
||||
}
|
||||
|
||||
BinaryFieldMapper sourceMergeWith = (BinaryFieldMapper) mergeWith;
|
||||
|
||||
if (this.fieldType().stored() != sourceMergeWith.fieldType().stored()) {
|
||||
mergeContext.addConflict("mapper [" + names.fullName() + "] has different store values");
|
||||
}
|
||||
if (!this.names().equals(sourceMergeWith.names())) {
|
||||
mergeContext.addConflict("mapper [" + names.fullName() + "] has different index_name");
|
||||
}
|
||||
|
||||
if (!mergeContext.mergeFlags().simulate()) {
|
||||
if (sourceMergeWith.compress != null) {
|
||||
this.compress = sourceMergeWith.compress;
|
||||
|
|
Loading…
Reference in New Issue