本文整理汇总了Java中org.elasticsearch.index.mapper.core.StringFieldMapper.merge方法的典型用法代码示例。如果您正苦于以下问题:Java StringFieldMapper.merge方法的具体用法?Java StringFieldMapper.merge怎么用?Java StringFieldMapper.merge使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.elasticsearch.index.mapper.core.StringFieldMapper
的用法示例。
在下文中一共展示了StringFieldMapper.merge方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doMerge
import org.elasticsearch.index.mapper.core.StringFieldMapper; //导入方法依赖的package包/类
@Override
public void doMerge(Mapper mergeWith, boolean includeInAll) throws MergeMappingException {
super.doMerge(mergeWith, includeInAll);
OntologyMapper oMergeWith = (OntologyMapper) mergeWith;
OntologySettings mergeSettings = oMergeWith.ontologySettings;
if (mergeSettings.getOntologyUri() != null && !mergeSettings.getOntologyUri().equals(ontologySettings.getOntologyUri())) {
throw new IllegalArgumentException("mapper [" + fieldType().names().fullName() + "] has different ontology URI");
} else if (mergeSettings.getOlsBaseUrl() != null && !mergeSettings.getOlsBaseUrl().equals(ontologySettings.getOlsBaseUrl())) {
throw new IllegalArgumentException("mapper [" + fieldType().names().fullName() + "] has different OLS base URL");
}
// Merge the mappers
List<FieldMapper> newFieldMappers = null;
Map<String, StringFieldMapper> newMapperMap = null;
for (Entry<String, StringFieldMapper> entry : oMergeWith.mappers.entrySet()) {
StringFieldMapper mergeIntoMapper = mappers.get(entry.getKey());
if (mergeIntoMapper == null) {
if (newFieldMappers == null) {
newFieldMappers = new ArrayList<>(oMergeWith.mappers.size());
newMapperMap = new HashMap<>();
}
newFieldMappers.add(entry.getValue());
newMapperMap.put(entry.getKey(), entry.getValue());
} else {
mergeIntoMapper.merge(entry.getValue(), includeInAll);
}
}
if (newFieldMappers != null) {
mappers = mappers.copyAndPutAll(newMapperMap);
}
}
示例2: merge
import org.elasticsearch.index.mapper.core.StringFieldMapper; //导入方法依赖的package包/类
@Override
public void merge(Mapper mergeWith, MergeResult mergeResult) throws MergeMappingException {
super.merge(mergeWith, mergeResult);
if (!this.getClass().equals(mergeWith.getClass())) {
return;
}
OntologyMapper oMergeWith = (OntologyMapper) mergeWith;
OntologySettings mergeSettings = oMergeWith.ontologySettings;
if (mergeSettings.getOntologyUri() != null && !mergeSettings.getOntologyUri().equals(ontologySettings.getOntologyUri())) {
mergeResult.addConflict("mapper [" + fieldType().names().fullName() + "] has different ontology URI");
} else if (mergeSettings.getOlsBaseUrl() != null && !mergeSettings.getOlsBaseUrl().equals(ontologySettings.getOlsBaseUrl())) {
mergeResult.addConflict("mapper [" + fieldType().names().fullName() + "] has different OLS base URL");
}
// Not sure if the below is necessary or not...
if (!mergeResult.simulate() && !mergeResult.hasConflicts()) {
// Merge the mappers
List<FieldMapper> newFieldMappers = null;
Map<String, StringFieldMapper> newMapperMap = null;
for (Entry<String, StringFieldMapper> entry : oMergeWith.mappers.entrySet()) {
StringFieldMapper mergeIntoMapper = mappers.get(entry.getKey());
if (mergeIntoMapper == null) {
if (newFieldMappers == null) {
newFieldMappers = new ArrayList<>(oMergeWith.mappers.size());
newMapperMap = new HashMap<>();
}
newFieldMappers.add(entry.getValue());
newMapperMap.put(entry.getKey(), entry.getValue());
} else {
mergeIntoMapper.merge(entry.getValue(), mergeResult);
}
}
if (newFieldMappers != null) {
mergeResult.addFieldMappers(newFieldMappers);
mappers = mappers.copyAndPutAll(newMapperMap);
}
}
}
示例3: merge
import org.elasticsearch.index.mapper.core.StringFieldMapper; //导入方法依赖的package包/类
@Override
public void merge(Mapper mergeWith, MergeResult mergeResult) throws MergeMappingException {
super.merge(mergeWith, mergeResult);
if (!this.getClass().equals(mergeWith.getClass())) {
return;
}
OntologyMapper oMergeWith = (OntologyMapper)mergeWith;
OntologySettings mergeSettings = oMergeWith.ontologySettings;
if (mergeSettings.getOntologyUri() != null && !mergeSettings.getOntologyUri().equals(ontologySettings.getOntologyUri())) {
mergeResult.addConflict("mapper [" + fieldType().names().fullName() + "] has different ontology URI");
} else if (mergeSettings.getOlsBaseUrl() != null && !mergeSettings.getOlsBaseUrl().equals(ontologySettings.getOlsBaseUrl())) {
mergeResult.addConflict("mapper [" + fieldType().names().fullName() + "] has different OLS base URL");
}
// Not sure if the below is necessary or not...
if (!mergeResult.simulate() && !mergeResult.hasConflicts()) {
// Merge the mappers
List<FieldMapper> newFieldMappers = null;
Map<String, StringFieldMapper> newMapperMap = null;
for (Entry<String, StringFieldMapper> entry : oMergeWith.mappers.entrySet()) {
StringFieldMapper mergeIntoMapper = mappers.get(entry.getKey());
if (mergeIntoMapper == null) {
if (newFieldMappers == null) {
newFieldMappers = new ArrayList<>(oMergeWith.mappers.size());
newMapperMap = new HashMap<>();
}
newFieldMappers.add(entry.getValue());
newMapperMap.put(entry.getKey(), entry.getValue());
} else {
mergeIntoMapper.merge(entry.getValue(), mergeResult);
}
}
if (newFieldMappers != null) {
mergeResult.addFieldMappers(newFieldMappers);
mappers = mappers.copyAndPutAll(newMapperMap);
}
}
}