org.springframework.data.elasticsearch.ElasticsearchException Java Examples

The following examples show how to use org.springframework.data.elasticsearch.ElasticsearchException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SearchBuilder.java    From microservices-platform with Apache License 2.0 5 votes vote down vote up
/**
 * 组装高亮字符
 * @param result 目标对象
 * @param highlightFields 高亮配置
 */
private <T> void populateHighLightedFields(T result, Map<String, HighlightField> highlightFields) {
    for (HighlightField field : highlightFields.values()) {
        try {
            String name = field.getName();
            if (!name.endsWith(".keyword")) {
                PropertyUtils.setProperty(result, field.getName(), concat(field.fragments()));
            }
        } catch (InvocationTargetException | IllegalAccessException | NoSuchMethodException e) {
            throw new ElasticsearchException("failed to set highlighted value for field: " + field.getName()
                    + " with value: " + Arrays.toString(field.getFragments()), e);
        }
    }
}
 
Example #2
Source File: ResultMapperExt.java    From roncoo-education with MIT License 5 votes vote down vote up
private <T> void populateHighLightedFields(T result, Map<String, HighlightField> highlightFields) {
	for (HighlightField field : highlightFields.values()) {
		try {
			setProperties(result, field.getName(), concat(field.fragments()));
		} catch (IntrospectionException | IllegalAccessException | InvocationTargetException e) {
			throw new ElasticsearchException("failed to set highlighted value for field: " + field.getName() + " with value: " + Arrays.toString(field.getFragments()), e);
		}
	}
}