예제 #1
0
 public DocumentMapper parse(String mappingType, String mappingSource, boolean applyDefault)
     throws MapperParsingException {
   String defaultMappingSource;
   if (PercolatorService.TYPE_NAME.equals(mappingType)) {
     defaultMappingSource = this.defaultPercolatorMappingSource;
   } else {
     defaultMappingSource = this.defaultMappingSource;
   }
   return documentParser.parse(
       mappingType, mappingSource, applyDefault ? defaultMappingSource : null);
 }
예제 #2
0
 public DocumentMapper merge(String type, String mappingSource, boolean applyDefault) {
   if (DEFAULT_MAPPING.equals(type)) {
     // verify we can parse it
     DocumentMapper mapper = documentParser.parse(type, mappingSource);
     // still add it as a document mapper so we have it registered and, for example, persisted back
     // into
     // the cluster meta data if needed, or checked for existence
     synchronized (typeMutex) {
       mappers = newMapBuilder(mappers).put(type, mapper).map();
     }
     defaultMappingSource = mappingSource;
     return mapper;
   } else {
     return merge(parse(type, mappingSource, applyDefault));
   }
 }