当前位置: 首页>>代码示例>>Java>>正文


Java StringFieldMapper.Builder方法代码示例

本文整理汇总了Java中org.elasticsearch.index.mapper.core.StringFieldMapper.Builder方法的典型用法代码示例。如果您正苦于以下问题:Java StringFieldMapper.Builder方法的具体用法?Java StringFieldMapper.Builder怎么用?Java StringFieldMapper.Builder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.elasticsearch.index.mapper.core.StringFieldMapper的用法示例。


在下文中一共展示了StringFieldMapper.Builder方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: failIfFieldMappingNotFound

import org.elasticsearch.index.mapper.core.StringFieldMapper; //导入方法依赖的package包/类
private MappedFieldType failIfFieldMappingNotFound(String name, MappedFieldType fieldMapping) {
    if (fieldMapping != null || allowUnmappedFields) {
        return fieldMapping;
    } else if (mapUnmappedFieldAsString){
        StringFieldMapper.Builder builder = MapperBuilders.stringField(name);
        // it would be better to pass the real index settings, but they are not easily accessible from here...
        Settings settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, indexQueryParser.getIndexCreatedVersion()).build();
        return builder.build(new Mapper.BuilderContext(settings, new ContentPath(1))).fieldType();
    } else {
        Version indexCreatedVersion = indexQueryParser.getIndexCreatedVersion();
        if (fieldMapping == null && indexCreatedVersion.onOrAfter(Version.V_1_4_0_Beta1)) {
            throw new QueryParsingException(this, "Strict field resolution and no field mapping can be found for the field with name ["
                    + name + "]");
        } else {
            return fieldMapping;
        }
    }
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:19,代码来源:QueryParseContext.java

示例2: parse

import org.elasticsearch.index.mapper.core.StringFieldMapper; //导入方法依赖的package包/类
/**
 * Parse the mapping definition for the ontology type.
 *
 * @param name          the field name
 * @param node          the JSON node holding the mapping definitions.
 * @param parserContext the parser context object.
 * @return a Builder for an OntologyMapper.
 */
@SuppressWarnings("unchecked")
@Override
public Builder parse(String name, Map<String, Object> node, ParserContext parserContext)
		throws MapperParsingException {
	OntologySettings ontologySettings = null;

	Builder builder = new Builder(name, threadPool);

	for (Iterator<Map.Entry<String, Object>> iterator = node.entrySet().iterator(); iterator.hasNext(); ) {
		Entry<String, Object> entry = iterator.next();
		if (entry.getKey().equals(OntologySettings.ONTOLOGY_SETTINGS_KEY)) {
			ontologySettings = new OntologySettingsBuilder()
					.settingsNode((Map<String, Object>) entry.getValue())
					.build();
			iterator.remove();
		} else if (entry.getKey().equals(ONTOLOGY_PROPERTIES)) {
			Map<String, StringFieldMapper.Builder> builders = parseProperties((Map<String, Object>) entry.getValue(), parserContext);
			builder.propertyBuilders(builders);
			iterator.remove();
		}
	}

	if (ontologySettings == null) {
		throw new MapperParsingException("No ontology settings supplied");
	} else if (StringUtils.isBlank(ontologySettings.getOntologyUri())
			&& StringUtils.isBlank(ontologySettings.getOlsBaseUrl())) {
		throw new MapperParsingException("No ontology URI or OLS details supplied");
	} else {
		builder = builder.ontologySettings(ontologySettings);
	}

	return builder;
}
 
开发者ID:flaxsearch,项目名称:BioSolr,代码行数:42,代码来源:OntologyMapper.java

示例3: parseProperties

import org.elasticsearch.index.mapper.core.StringFieldMapper; //导入方法依赖的package包/类
private Map<String, StringFieldMapper.Builder> parseProperties(Map<String, Object> propertiesNode, ParserContext parserContext) {
	Map<String, StringFieldMapper.Builder> propertyMap = new HashMap<>();
	for (Iterator<Map.Entry<String, Object>> iterator = propertiesNode.entrySet().iterator(); iterator.hasNext(); ) {
		Entry<String, Object> entry = iterator.next();
		String name = entry.getKey();

		@SuppressWarnings("unchecked")
		Mapper.Builder builder = new StringFieldMapper.TypeParser().parse(entry.getKey(), (Map<String, Object>) entry.getValue(), parserContext);
		propertyMap.put(name, (StringFieldMapper.Builder) builder);
	}
	return propertyMap;
}
 
开发者ID:flaxsearch,项目名称:BioSolr,代码行数:13,代码来源:OntologyMapper.java

示例4: parse

import org.elasticsearch.index.mapper.core.StringFieldMapper; //导入方法依赖的package包/类
/**
 * Parse the mapping definition for the ontology type.
 *
 * @param name          the field name
 * @param node          the JSON node holding the mapping definitions.
 * @param parserContext the parser context object.
 * @return a Builder for an OntologyMapper.
 */
@SuppressWarnings("unchecked")
@Override
public Builder parse(String name, Map<String, Object> node, ParserContext parserContext)
		throws MapperParsingException {
	OntologySettings ontologySettings = null;

	Builder builder = new Builder(name);
	parseField(builder, name, node, parserContext);

	for (Iterator<Entry<String, Object>> iterator = node.entrySet().iterator(); iterator.hasNext(); ) {
		Entry<String, Object> entry = iterator.next();
		if (entry.getKey().equals(OntologySettings.ONTOLOGY_SETTINGS_KEY)) {
			ontologySettings = new OntologySettingsBuilder()
					.settingsNode((Map<String, Object>) entry.getValue())
					.build();
			iterator.remove();
		} else if (entry.getKey().equals(ONTOLOGY_PROPERTIES)) {
			Map<String, StringFieldMapper.Builder> builders = parseProperties((Map<String, Object>) entry.getValue(), parserContext);
			builder = builder.propertyBuilders(builders);
			iterator.remove();
		}
	}

	if (ontologySettings == null) {
		throw new MapperParsingException("No ontology settings supplied");
	} else if (StringUtils.isBlank(ontologySettings.getOntologyUri())
			&& StringUtils.isBlank(ontologySettings.getOlsBaseUrl())) {
		throw new MapperParsingException("No ontology URI or OLS details supplied");
	} else {
		builder = builder.ontologySettings(ontologySettings);
	}

	return builder;
}
 
开发者ID:flaxsearch,项目名称:BioSolr,代码行数:43,代码来源:OntologyMapper.java

示例5: parseProperties

import org.elasticsearch.index.mapper.core.StringFieldMapper; //导入方法依赖的package包/类
private Map<String, StringFieldMapper.Builder> parseProperties(Map<String, Object> propertiesNode, ParserContext parserContext) {
	Map<String, StringFieldMapper.Builder> propertyMap = new HashMap<>();
	for (Iterator<Entry<String, Object>> iterator = propertiesNode.entrySet().iterator(); iterator.hasNext(); ) {
		Entry<String, Object> entry = iterator.next();
		String name = entry.getKey();

		@SuppressWarnings("unchecked")
		Mapper.Builder builder = new StringFieldMapper.TypeParser().parse(entry.getKey(), (Map<String, Object>) entry.getValue(), parserContext);
		propertyMap.put(name, (StringFieldMapper.Builder) builder);
	}
	return propertyMap;
}
 
开发者ID:flaxsearch,项目名称:BioSolr,代码行数:13,代码来源:OntologyMapper.java

示例6: parse

import org.elasticsearch.index.mapper.core.StringFieldMapper; //导入方法依赖的package包/类
/**
 * Parse the mapping definition for the ontology type.
 *
 * @param name the field name
 * @param node the JSON node holding the mapping definitions.
 * @param parserContext the parser context
 * @return a Builder for an OntologyMapper.
 */
@SuppressWarnings("unchecked")
@Override
public Builder parse(String name, Map<String, Object> node, ParserContext parserContext)
		throws MapperParsingException {
	OntologySettings ontologySettings = null;

	Builder builder = new Builder(name, threadPool);

	for (Iterator<Map.Entry<String, Object>> iterator = node.entrySet().iterator(); iterator.hasNext();) {
		Entry<String, Object> entry = iterator.next();
		if (entry.getKey().equals(OntologySettings.ONTOLOGY_SETTINGS_KEY)) {
			ontologySettings = new OntologySettingsBuilder()
					.settingsNode((Map<String, Object>) entry.getValue())
					.build();
			iterator.remove();
		} else if (entry.getKey().equals(ONTOLOGY_PROPERTIES)) {
			Map<String, StringFieldMapper.Builder> builders = parseProperties((Map<String, Object>) entry.getValue(), parserContext);
			builder.propertyBuilders(builders);
			iterator.remove();
		}
	}

	if (ontologySettings == null) {
		throw new MapperParsingException("No ontology settings supplied");
	} else if (StringUtils.isBlank(ontologySettings.getOntologyUri())
			&& StringUtils.isBlank(ontologySettings.getOlsBaseUrl())) {
		throw new MapperParsingException("No ontology URI or OLS details supplied");
	} else {
		builder = builder.ontologySettings(ontologySettings);
	}

	return builder;
}
 
开发者ID:flaxsearch,项目名称:BioSolr,代码行数:42,代码来源:OntologyMapper.java

示例7: parseProperties

import org.elasticsearch.index.mapper.core.StringFieldMapper; //导入方法依赖的package包/类
private Map<String, StringFieldMapper.Builder> parseProperties(Map<String, Object> propertiesNode, ParserContext parserContext) {
	Map<String, StringFieldMapper.Builder> propertyMap = new HashMap<>();
	for (Iterator<Map.Entry<String, Object>> iterator = propertiesNode.entrySet().iterator(); iterator.hasNext();) {
		Entry<String, Object> entry = iterator.next();
		String name = entry.getKey();

		@SuppressWarnings("unchecked")
		Mapper.Builder builder = new StringFieldMapper.TypeParser().parse(entry.getKey(), (Map<String, Object>)entry.getValue(), parserContext);
		propertyMap.put(name, (StringFieldMapper.Builder)builder);
	}
	return propertyMap;
}
 
开发者ID:flaxsearch,项目名称:BioSolr,代码行数:13,代码来源:OntologyMapper.java

示例8: parse

import org.elasticsearch.index.mapper.core.StringFieldMapper; //导入方法依赖的package包/类
/**
 * Parse the mapping definition for the ontology type.
 *
 * @param name          the field name
 * @param node          the JSON node holding the mapping definitions.
 * @param parserContext the parser context object.
 * @return a Builder for an OntologyMapper.
 */
@SuppressWarnings("unchecked")
@Override
public Builder parse(String name, Map<String, Object> node, ParserContext parserContext)
		throws MapperParsingException {
	OntologySettings ontologySettings = null;

	Builder builder = new Builder(name, threadPool);
	parseField(builder, name, node, parserContext);

	for (Iterator<Entry<String, Object>> iterator = node.entrySet().iterator(); iterator.hasNext();) {
		Entry<String, Object> entry = iterator.next();
		if (entry.getKey().equals(OntologySettings.ONTOLOGY_SETTINGS_KEY)) {
			ontologySettings = new OntologySettingsBuilder()
					.settingsNode((Map<String, Object>) entry.getValue())
					.build();
			iterator.remove();
		} else if (entry.getKey().equals(ONTOLOGY_PROPERTIES)) {
			Map<String, StringFieldMapper.Builder> builders = parseProperties((Map<String, Object>) entry.getValue(), parserContext);
			builder = builder.propertyBuilders(builders);
			iterator.remove();
		}
	}

	if (ontologySettings == null) {
		throw new MapperParsingException("No ontology settings supplied");
	} else if (StringUtils.isBlank(ontologySettings.getOntologyUri())
			&& StringUtils.isBlank(ontologySettings.getOlsBaseUrl())) {
		throw new MapperParsingException("No ontology URI or OLS details supplied");
	} else {
		builder = builder.ontologySettings(ontologySettings);
	}

	return builder;
}
 
开发者ID:flaxsearch,项目名称:BioSolr,代码行数:43,代码来源:OntologyMapper.java

示例9: parseProperties

import org.elasticsearch.index.mapper.core.StringFieldMapper; //导入方法依赖的package包/类
private Map<String, StringFieldMapper.Builder> parseProperties(Map<String, Object> propertiesNode, ParserContext parserContext) {
	Map<String, StringFieldMapper.Builder> propertyMap = new HashMap<>();
	for (Iterator<Entry<String, Object>> iterator = propertiesNode.entrySet().iterator(); iterator.hasNext();) {
		Entry<String, Object> entry = iterator.next();
		String name = entry.getKey();

		@SuppressWarnings("unchecked")
		Mapper.Builder builder = new StringFieldMapper.TypeParser().parse(entry.getKey(), (Map<String, Object>)entry.getValue(), parserContext);
		propertyMap.put(name, (StringFieldMapper.Builder)builder);
	}
	return propertyMap;
}
 
开发者ID:flaxsearch,项目名称:BioSolr,代码行数:13,代码来源:OntologyMapper.java

示例10: stringField

import org.elasticsearch.index.mapper.core.StringFieldMapper; //导入方法依赖的package包/类
public static StringFieldMapper.Builder stringField(String name) {
    return new StringFieldMapper.Builder(name);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:4,代码来源:MapperBuilders.java

示例11: propertyBuilders

import org.elasticsearch.index.mapper.core.StringFieldMapper; //导入方法依赖的package包/类
public Builder propertyBuilders(Map<String, StringFieldMapper.Builder> props) {
	this.propertyBuilders = props;
	return this;
}
 
开发者ID:flaxsearch,项目名称:BioSolr,代码行数:5,代码来源:OntologyMapper.java

示例12: names

import org.elasticsearch.index.mapper.core.StringFieldMapper; //导入方法依赖的package包/类
public Builder names(StringFieldMapper.Builder namesBuilder) {
    this.nameBuilder = namesBuilder;
    return this;
}
 
开发者ID:spinscale,项目名称:elasticsearch-opennlp-plugin,代码行数:5,代码来源:OpenNlpMapper.java

示例13: dates

import org.elasticsearch.index.mapper.core.StringFieldMapper; //导入方法依赖的package包/类
public Builder dates(StringFieldMapper.Builder datesBuilder) {
    this.dateBuilder = datesBuilder;
    return this;
}
 
开发者ID:spinscale,项目名称:elasticsearch-opennlp-plugin,代码行数:5,代码来源:OpenNlpMapper.java

示例14: locations

import org.elasticsearch.index.mapper.core.StringFieldMapper; //导入方法依赖的package包/类
public Builder locations(StringFieldMapper.Builder locationsBuilder) {
    this.locationBuilder = locationsBuilder;
    return this;
}
 
开发者ID:spinscale,项目名称:elasticsearch-opennlp-plugin,代码行数:5,代码来源:OpenNlpMapper.java


注:本文中的org.elasticsearch.index.mapper.core.StringFieldMapper.Builder方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。