新增功能:
父子类型功能完整支持,新增功能包括:
1.新增对父子类型索引自动托管及手动API维护的支持
2.新增对父子类型文档的各种CRUD
3.索引在手动挡模式下,新增API通过实体及其注解信息一键傻瓜级创建索引,功能与自动挡-运动模式一样,但触发方式为手动.
4.新增获取索引详细信息的接口(之前仅提供了获取索引是否存在的接口)
5.新增对嵌套类型的嵌套文档也可指定其索引分词器功能
7.新增手动挡api指定创建索引字段的权重值
8.新增对索引中同一字段既为text又为keyword的类型支持

项目调整:
由于目前已长期持有easy-es.cn的域名,所以对项目原有的包名及maven中央仓库坐标作了相应调整
1.从0.9.30版本起调整项目Maven中央仓库中的groupId由io.github.xpc1024调整为cn.easy-es,已发布的老版本不受影响.
2.项目所有包名由com.xpc调整为cn.easy-es打头
3.新增common,annotation,test子模块,并调整了原项目结构,让模块之间耦合进一步降低,提升可读性,更易于维护.为即将迎来的性能测试,压力测试等埋下伏笔.

体验优化:
1.enableMust2filter配置生效范围增加对in,notIn,between等类型查询的全面支持.
2.进一步简化高亮功能的使用门槛,代价是粒度比较粗,所有查询类接口都会返回高亮字段,牺牲了少量灵活性,但用起来更傻X,ORM框架还是Easy至上!
3.针对自动托管索引的平滑模式,提供了"擦屁股"功能,在小概率索引迁移因各种原因迁移失败后,自动清理失败的索引及可能出现的死锁,原索引不受任何影响,干净无残留!

缺陷修复:
1.修复multiMatchQuery查询参数被重复封装2次的缺陷.
This commit is contained in:
xpc1024 2022-06-07 18:25:39 +08:00
parent f82feaed45
commit 748ce938e8
5 changed files with 28 additions and 45 deletions

View File

@ -1,33 +0,0 @@
package cn.easyes.common.utils;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.UndeclaredThrowableException;
/**
* <p>
* ExceptionUtil
* </p>
*
* @author lilu
* @since 2022/3/4
*/
public class ExceptionUtil {
private ExceptionUtil() {
// Prevent Instantiation
}
public static Throwable unwrapThrowable(Throwable wrapped) {
Throwable unwrapped = wrapped;
while (true) {
if (unwrapped instanceof InvocationTargetException) {
unwrapped = ((InvocationTargetException) unwrapped).getTargetException();
} else if (unwrapped instanceof UndeclaredThrowableException) {
unwrapped = ((UndeclaredThrowableException) unwrapped).getUndeclaredThrowable();
} else {
return unwrapped;
}
}
}
}

View File

@ -3,6 +3,9 @@ package cn.easyes.common.utils;
import cn.easyes.common.exception.EasyEsException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.UndeclaredThrowableException;
/**
* 异常辅助工具类
* <p>
@ -46,4 +49,23 @@ public final class ExceptionUtils {
return new EasyEsException(t);
}
/**
* 异常包装
*
* @param wrapped 异常
* @return 异常
*/
public static Throwable unwrapThrowable(Throwable wrapped) {
Throwable unwrapped = wrapped;
while (true) {
if (unwrapped instanceof InvocationTargetException) {
unwrapped = ((InvocationTargetException) unwrapped).getTargetException();
} else if (unwrapped instanceof UndeclaredThrowableException) {
unwrapped = ((UndeclaredThrowableException) unwrapped).getUndeclaredThrowable();
} else {
return unwrapped;
}
}
}
}

View File

@ -74,10 +74,6 @@ public class EntityInfo {
* join关系字段类 默认为JoinField.class
*/
private Class<?> joinFieldClass = JoinField.class;
/**
* 嵌套类的path和类对应关系
*/
private Map<String, Class<?>> nestedPathClassMap = new HashMap<>();
/**
* 嵌套类的字段信息列表
*/

View File

@ -327,7 +327,7 @@ public class EntityInfoHelper {
entityInfo.setJoinFieldName(mappingColumn);
entityInfo.setJoinFieldClass(tableField.joinFieldClass());
entityInfo.getPathClassMap().putIfAbsent(field.getName(), tableField.joinFieldClass());
processNested(tableField.joinFieldClass(), field.getName(), field.getName(), dbConfig, entityInfo);
processNested(tableField.joinFieldClass(),dbConfig, entityInfo);
}
fieldList.add(entityFieldInfo);
@ -335,9 +335,8 @@ public class EntityInfoHelper {
// 嵌套类处理
if (DefaultNestedClass.class != tableField.nestedClass()) {
// 嵌套类
entityInfo.getNestedPathClassMap().putIfAbsent(field.getName(), tableField.nestedClass());
entityInfo.getPathClassMap().putIfAbsent(field.getName(), tableField.nestedClass());
processNested(tableField.nestedClass(), field.getName(), field.getName(), dbConfig, entityInfo);
processNested(tableField.nestedClass(), dbConfig, entityInfo);
}
} else {
@ -381,7 +380,7 @@ public class EntityInfoHelper {
* @param dbConfig 全局配置
* @param entityInfo 实体信息
*/
private static void processNested(Class<?> nestedClass, String path, String prefix, GlobalConfig.DbConfig dbConfig, EntityInfo entityInfo) {
private static void processNested(Class<?> nestedClass, GlobalConfig.DbConfig dbConfig, EntityInfo entityInfo) {
// 将字段映射置入map 对其子节点也执行同样的操作
List<Field> allFields = getAllFields(nestedClass);
Map<String, String> mappingColumnMap = new HashMap<>(allFields.size());
@ -403,9 +402,8 @@ public class EntityInfoHelper {
if (tableField.exist()) {
// 子嵌套,递归处理
if (DefaultNestedClass.class != tableField.nestedClass()) {
entityInfo.getNestedPathClassMap().putIfAbsent(path, nestedClass);
entityInfo.getPathClassMap().putIfAbsent(field.getName(), tableField.nestedClass());
processNested(tableField.nestedClass(), field.getName(), prefix + POINT + field.getName(), dbConfig, entityInfo);
processNested(tableField.nestedClass(), dbConfig, entityInfo);
}
// 字段名称

View File

@ -3,7 +3,7 @@ package cn.easyes.extension.plugins;
import cn.easyes.annotation.Intercepts;
import cn.easyes.annotation.Signature;
import cn.easyes.common.utils.ExceptionUtil;
import cn.easyes.common.utils.ExceptionUtils;
import cn.easyes.extension.context.Interceptor;
import cn.easyes.extension.context.Invocation;
@ -61,7 +61,7 @@ public class Plugin implements InvocationHandler {
}
return method.invoke(target, args);
} catch (Exception e) {
throw ExceptionUtil.unwrapThrowable(e);
throw ExceptionUtils.unwrapThrowable(e);
}
}