mirror of
https://gitee.com/dromara/easy-es.git
synced 2025-12-07 01:28:37 +08:00
feat: 优化索引创建
This commit is contained in:
parent
aaced54f5d
commit
d6c6ffe64d
@ -38,7 +38,7 @@ public class BaseSortParam {
|
|||||||
/**
|
/**
|
||||||
* 计算方式 ARC PLANE 默认PLANE
|
* 计算方式 ARC PLANE 默认PLANE
|
||||||
*/
|
*/
|
||||||
private GeoDistanceType geoDistance;
|
private GeoDistanceType geoDistanceType;
|
||||||
/**
|
/**
|
||||||
* 距离单位 默认为km
|
* 距离单位 默认为km
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -217,7 +217,7 @@ public interface Func<Children, R> extends Serializable {
|
|||||||
* @return wrapper
|
* @return wrapper
|
||||||
*/
|
*/
|
||||||
default Children orderByDistanceAsc(R column, double lat, double lon) {
|
default Children orderByDistanceAsc(R column, double lat, double lon) {
|
||||||
return orderByDistanceAsc(true, FieldUtils.getFieldName(column), DistanceUnit.Meters, GeoDistanceType.Plane, GeoUtils.create(lat, lon));
|
return orderByDistanceAsc(true, FieldUtils.getFieldName(column), DistanceUnit.Kilometers, GeoDistanceType.Plane, GeoUtils.create(lat, lon));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -237,13 +237,13 @@ public interface Func<Children, R> extends Serializable {
|
|||||||
* 地理位置坐标点由近及远排序
|
* 地理位置坐标点由近及远排序
|
||||||
*
|
*
|
||||||
* @param column 列
|
* @param column 列
|
||||||
* @param geoDistance 距离计算方式
|
* @param geoDistanceType 距离计算方式
|
||||||
* @param lat 纬度
|
* @param lat 纬度
|
||||||
* @param lon 经度
|
* @param lon 经度
|
||||||
* @return wrapper`
|
* @return wrapper`
|
||||||
*/
|
*/
|
||||||
default Children orderByDistanceAsc(R column, GeoDistanceType geoDistance, double lat, double lon) {
|
default Children orderByDistanceAsc(R column, GeoDistanceType geoDistanceType, double lat, double lon) {
|
||||||
return orderByDistanceAsc(true, FieldUtils.getFieldName(column), DistanceUnit.Meters, geoDistance, GeoUtils.create(lat, lon));
|
return orderByDistanceAsc(true, FieldUtils.getFieldName(column), DistanceUnit.Kilometers, geoDistanceType, GeoUtils.create(lat, lon));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -251,13 +251,13 @@ public interface Func<Children, R> extends Serializable {
|
|||||||
*
|
*
|
||||||
* @param column 列
|
* @param column 列
|
||||||
* @param unit 距离单位
|
* @param unit 距离单位
|
||||||
* @param geoDistance 距离计算方式
|
* @param geoDistanceType 距离计算方式
|
||||||
* @param lat 纬度
|
* @param lat 纬度
|
||||||
* @param lon 经度
|
* @param lon 经度
|
||||||
* @return wrapper
|
* @return wrapper
|
||||||
*/
|
*/
|
||||||
default Children orderByDistanceAsc(R column, DistanceUnit unit, GeoDistanceType geoDistance, double lat, double lon) {
|
default Children orderByDistanceAsc(R column, DistanceUnit unit, GeoDistanceType geoDistanceType, double lat, double lon) {
|
||||||
return orderByDistanceAsc(true, FieldUtils.getFieldName(column), unit, geoDistance, GeoUtils.create(lat, lon));
|
return orderByDistanceAsc(true, FieldUtils.getFieldName(column), unit, geoDistanceType, GeoUtils.create(lat, lon));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -268,7 +268,7 @@ public interface Func<Children, R> extends Serializable {
|
|||||||
* @return wrapper
|
* @return wrapper
|
||||||
*/
|
*/
|
||||||
default Children orderByDistanceAsc(R column, GeoLocation... geoPoints) {
|
default Children orderByDistanceAsc(R column, GeoLocation... geoPoints) {
|
||||||
return orderByDistanceAsc(true, FieldUtils.getFieldName(column), DistanceUnit.Meters, GeoDistanceType.Plane, geoPoints);
|
return orderByDistanceAsc(true, FieldUtils.getFieldName(column), DistanceUnit.Kilometers, GeoDistanceType.Plane, geoPoints);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -287,12 +287,12 @@ public interface Func<Children, R> extends Serializable {
|
|||||||
* 地理位置坐标点由近及远排序
|
* 地理位置坐标点由近及远排序
|
||||||
*
|
*
|
||||||
* @param column 列
|
* @param column 列
|
||||||
* @param geoDistance 距离计算方式
|
* @param geoDistanceType 距离计算方式
|
||||||
* @param geoPoints 多边形坐标点数组
|
* @param geoPoints 多边形坐标点数组
|
||||||
* @return wrapper
|
* @return wrapper
|
||||||
*/
|
*/
|
||||||
default Children orderByDistanceAsc(R column, GeoDistanceType geoDistance, GeoLocation... geoPoints) {
|
default Children orderByDistanceAsc(R column, GeoDistanceType geoDistanceType, GeoLocation... geoPoints) {
|
||||||
return orderByDistanceAsc(true, FieldUtils.getFieldName(column), DistanceUnit.Meters, geoDistance, geoPoints);
|
return orderByDistanceAsc(true, FieldUtils.getFieldName(column), DistanceUnit.Kilometers, geoDistanceType, geoPoints);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -300,12 +300,12 @@ public interface Func<Children, R> extends Serializable {
|
|||||||
*
|
*
|
||||||
* @param column 列
|
* @param column 列
|
||||||
* @param unit 距离单位
|
* @param unit 距离单位
|
||||||
* @param geoDistance 距离计算方式
|
* @param geoDistanceType 距离计算方式
|
||||||
* @param geoPoints 多边形坐标点数组
|
* @param geoPoints 多边形坐标点数组
|
||||||
* @return wrapper
|
* @return wrapper
|
||||||
*/
|
*/
|
||||||
default Children orderByDistanceAsc(R column, DistanceUnit unit, GeoDistanceType geoDistance, GeoLocation... geoPoints) {
|
default Children orderByDistanceAsc(R column, DistanceUnit unit, GeoDistanceType geoDistanceType, GeoLocation... geoPoints) {
|
||||||
return orderByDistanceAsc(true, FieldUtils.getFieldName(column), unit, geoDistance, geoPoints);
|
return orderByDistanceAsc(true, FieldUtils.getFieldName(column), unit, geoDistanceType, geoPoints);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -317,7 +317,7 @@ public interface Func<Children, R> extends Serializable {
|
|||||||
* @return wrapper
|
* @return wrapper
|
||||||
*/
|
*/
|
||||||
default Children orderByDistanceAsc(String column, double lat, double lon) {
|
default Children orderByDistanceAsc(String column, double lat, double lon) {
|
||||||
return orderByDistanceAsc(true, column, DistanceUnit.Meters, GeoDistanceType.Plane, GeoUtils.create(lat, lon));
|
return orderByDistanceAsc(true, column, DistanceUnit.Kilometers, GeoDistanceType.Plane, GeoUtils.create(lat, lon));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -337,13 +337,13 @@ public interface Func<Children, R> extends Serializable {
|
|||||||
* 地理位置坐标点由近及远排序
|
* 地理位置坐标点由近及远排序
|
||||||
*
|
*
|
||||||
* @param column 列名 字符串
|
* @param column 列名 字符串
|
||||||
* @param geoDistance 距离计算方式
|
* @param geoDistanceType 距离计算方式
|
||||||
* @param lat 纬度
|
* @param lat 纬度
|
||||||
* @param lon 经度
|
* @param lon 经度
|
||||||
* @return wrapper
|
* @return wrapper
|
||||||
*/
|
*/
|
||||||
default Children orderByDistanceAsc(String column, GeoDistanceType geoDistance, double lat, double lon) {
|
default Children orderByDistanceAsc(String column, GeoDistanceType geoDistanceType, double lat, double lon) {
|
||||||
return orderByDistanceAsc(true, column, DistanceUnit.Meters, geoDistance, GeoUtils.create(lat, lon));
|
return orderByDistanceAsc(true, column, DistanceUnit.Kilometers, geoDistanceType, GeoUtils.create(lat, lon));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -351,13 +351,13 @@ public interface Func<Children, R> extends Serializable {
|
|||||||
*
|
*
|
||||||
* @param column 列名 字符串
|
* @param column 列名 字符串
|
||||||
* @param unit 距离单位
|
* @param unit 距离单位
|
||||||
* @param geoDistance 距离计算方式
|
* @param geoDistanceType 距离计算方式
|
||||||
* @param lat 纬度
|
* @param lat 纬度
|
||||||
* @param lon 经度
|
* @param lon 经度
|
||||||
* @return wrapper
|
* @return wrapper
|
||||||
*/
|
*/
|
||||||
default Children orderByDistanceAsc(String column, DistanceUnit unit, GeoDistanceType geoDistance, double lat, double lon) {
|
default Children orderByDistanceAsc(String column, DistanceUnit unit, GeoDistanceType geoDistanceType, double lat, double lon) {
|
||||||
return orderByDistanceAsc(true, column, unit, geoDistance, GeoUtils.create(lat, lon));
|
return orderByDistanceAsc(true, column, unit, geoDistanceType, GeoUtils.create(lat, lon));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -368,7 +368,7 @@ public interface Func<Children, R> extends Serializable {
|
|||||||
* @return wrapper
|
* @return wrapper
|
||||||
*/
|
*/
|
||||||
default Children orderByDistanceAsc(String column, GeoLocation... geoPoints) {
|
default Children orderByDistanceAsc(String column, GeoLocation... geoPoints) {
|
||||||
return orderByDistanceAsc(true, column, DistanceUnit.Meters, GeoDistanceType.Plane, geoPoints);
|
return orderByDistanceAsc(true, column, DistanceUnit.Kilometers, GeoDistanceType.Plane, geoPoints);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -387,12 +387,12 @@ public interface Func<Children, R> extends Serializable {
|
|||||||
* 地理位置坐标点由近及远排序
|
* 地理位置坐标点由近及远排序
|
||||||
*
|
*
|
||||||
* @param column 列名 字符串
|
* @param column 列名 字符串
|
||||||
* @param geoDistance 距离计算方式
|
* @param geoDistanceType 距离计算方式
|
||||||
* @param geoPoints 多边形坐标点数组
|
* @param geoPoints 多边形坐标点数组
|
||||||
* @return wrapper
|
* @return wrapper
|
||||||
*/
|
*/
|
||||||
default Children orderByDistanceAsc(String column, GeoDistanceType geoDistance, GeoLocation... geoPoints) {
|
default Children orderByDistanceAsc(String column, GeoDistanceType geoDistanceType, GeoLocation... geoPoints) {
|
||||||
return orderByDistanceAsc(true, column, DistanceUnit.Meters, geoDistance, geoPoints);
|
return orderByDistanceAsc(true, column, DistanceUnit.Kilometers, geoDistanceType, geoPoints);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -400,12 +400,12 @@ public interface Func<Children, R> extends Serializable {
|
|||||||
*
|
*
|
||||||
* @param column 列名 字符串
|
* @param column 列名 字符串
|
||||||
* @param unit 距离单位
|
* @param unit 距离单位
|
||||||
* @param geoDistance 距离计算方式
|
* @param geoDistanceType 距离计算方式
|
||||||
* @param geoPoints 多边形坐标点数组
|
* @param geoPoints 多边形坐标点数组
|
||||||
* @return wrapper
|
* @return wrapper
|
||||||
*/
|
*/
|
||||||
default Children orderByDistanceAsc(String column, DistanceUnit unit, GeoDistanceType geoDistance, GeoLocation... geoPoints) {
|
default Children orderByDistanceAsc(String column, DistanceUnit unit, GeoDistanceType geoDistanceType, GeoLocation... geoPoints) {
|
||||||
return orderByDistanceAsc(true, column, unit, geoDistance, geoPoints);
|
return orderByDistanceAsc(true, column, unit, geoDistanceType, geoPoints);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -414,11 +414,11 @@ public interface Func<Children, R> extends Serializable {
|
|||||||
* @param condition 执行条件
|
* @param condition 执行条件
|
||||||
* @param column 列名 字符串
|
* @param column 列名 字符串
|
||||||
* @param unit 距离单位 重载方法默认为km
|
* @param unit 距离单位 重载方法默认为km
|
||||||
* @param geoDistance 距离计算方式,重载方法默认为GeoDistanceType.Plane
|
* @param geoDistanceType 距离计算方式,重载方法默认为GeoDistanceType.Plane
|
||||||
* @param geoPoints 多边形坐标点数组
|
* @param geoPoints 多边形坐标点数组
|
||||||
* @return wrapper
|
* @return wrapper
|
||||||
*/
|
*/
|
||||||
Children orderByDistanceAsc(boolean condition, String column, DistanceUnit unit, GeoDistanceType geoDistance, GeoLocation... geoPoints);
|
Children orderByDistanceAsc(boolean condition, String column, DistanceUnit unit, GeoDistanceType geoDistanceType, GeoLocation... geoPoints);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 地理位置坐标点由近及远排序
|
* 地理位置坐标点由近及远排序
|
||||||
@ -429,7 +429,7 @@ public interface Func<Children, R> extends Serializable {
|
|||||||
* @return wrapper
|
* @return wrapper
|
||||||
*/
|
*/
|
||||||
default Children orderByDistanceDesc(R column, double lat, double lon) {
|
default Children orderByDistanceDesc(R column, double lat, double lon) {
|
||||||
return orderByDistanceDesc(true, FieldUtils.getFieldName(column), DistanceUnit.Meters, GeoDistanceType.Plane, GeoUtils.create(lat, lon));
|
return orderByDistanceDesc(true, FieldUtils.getFieldName(column), DistanceUnit.Kilometers, GeoDistanceType.Plane, GeoUtils.create(lat, lon));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -449,13 +449,13 @@ public interface Func<Children, R> extends Serializable {
|
|||||||
* 地理位置坐标点由近及远排序
|
* 地理位置坐标点由近及远排序
|
||||||
*
|
*
|
||||||
* @param column 列
|
* @param column 列
|
||||||
* @param geoDistance 距离计算方式,重载方法默认为GeoDistanceType.Plane
|
* @param geoDistanceType 距离计算方式,重载方法默认为GeoDistanceType.Plane
|
||||||
* @param lat 纬度
|
* @param lat 纬度
|
||||||
* @param lon 经度
|
* @param lon 经度
|
||||||
* @return wrapper
|
* @return wrapper
|
||||||
*/
|
*/
|
||||||
default Children orderByDistanceDesc(R column, GeoDistanceType geoDistance, double lat, double lon) {
|
default Children orderByDistanceDesc(R column, GeoDistanceType geoDistanceType, double lat, double lon) {
|
||||||
return orderByDistanceDesc(true, FieldUtils.getFieldName(column), DistanceUnit.Meters, geoDistance, GeoUtils.create(lat, lon));
|
return orderByDistanceDesc(true, FieldUtils.getFieldName(column), DistanceUnit.Kilometers, geoDistanceType, GeoUtils.create(lat, lon));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -463,13 +463,13 @@ public interface Func<Children, R> extends Serializable {
|
|||||||
*
|
*
|
||||||
* @param column 列名
|
* @param column 列名
|
||||||
* @param unit 距离单位
|
* @param unit 距离单位
|
||||||
* @param geoDistance 距离计算方式,重载方法默认为GeoDistanceType.Plane
|
* @param geoDistanceType 距离计算方式,重载方法默认为GeoDistanceType.Plane
|
||||||
* @param lat 纬度
|
* @param lat 纬度
|
||||||
* @param lon 经度
|
* @param lon 经度
|
||||||
* @return wrapper
|
* @return wrapper
|
||||||
*/
|
*/
|
||||||
default Children orderByDistanceDesc(R column, DistanceUnit unit, GeoDistanceType geoDistance, double lat, double lon) {
|
default Children orderByDistanceDesc(R column, DistanceUnit unit, GeoDistanceType geoDistanceType, double lat, double lon) {
|
||||||
return orderByDistanceDesc(true, FieldUtils.getFieldName(column), unit, geoDistance, GeoUtils.create(lat, lon));
|
return orderByDistanceDesc(true, FieldUtils.getFieldName(column), unit, geoDistanceType, GeoUtils.create(lat, lon));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -480,7 +480,7 @@ public interface Func<Children, R> extends Serializable {
|
|||||||
* @return wrapper
|
* @return wrapper
|
||||||
*/
|
*/
|
||||||
default Children orderByDistanceDesc(R column, GeoLocation... geoPoints) {
|
default Children orderByDistanceDesc(R column, GeoLocation... geoPoints) {
|
||||||
return orderByDistanceDesc(true, FieldUtils.getFieldName(column), DistanceUnit.Meters, GeoDistanceType.Plane, geoPoints);
|
return orderByDistanceDesc(true, FieldUtils.getFieldName(column), DistanceUnit.Kilometers, GeoDistanceType.Plane, geoPoints);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -499,12 +499,12 @@ public interface Func<Children, R> extends Serializable {
|
|||||||
* 地理位置坐标点由近及远排序
|
* 地理位置坐标点由近及远排序
|
||||||
*
|
*
|
||||||
* @param column 列
|
* @param column 列
|
||||||
* @param geoDistance 距离计算方式,重载方法默认为GeoDistanceType.Plane
|
* @param geoDistanceType 距离计算方式,重载方法默认为GeoDistanceType.Plane
|
||||||
* @param geoPoints 多边形坐标点数组
|
* @param geoPoints 多边形坐标点数组
|
||||||
* @return wrapper
|
* @return wrapper
|
||||||
*/
|
*/
|
||||||
default Children orderByDistanceDesc(R column, GeoDistanceType geoDistance, GeoLocation... geoPoints) {
|
default Children orderByDistanceDesc(R column, GeoDistanceType geoDistanceType, GeoLocation... geoPoints) {
|
||||||
return orderByDistanceDesc(true, FieldUtils.getFieldName(column), DistanceUnit.Meters, geoDistance, geoPoints);
|
return orderByDistanceDesc(true, FieldUtils.getFieldName(column), DistanceUnit.Kilometers, geoDistanceType, geoPoints);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -512,12 +512,12 @@ public interface Func<Children, R> extends Serializable {
|
|||||||
*
|
*
|
||||||
* @param column 列
|
* @param column 列
|
||||||
* @param unit 距离单位
|
* @param unit 距离单位
|
||||||
* @param geoDistance 距离计算方式,重载方法默认为GeoDistanceType.Plane
|
* @param geoDistanceType 距离计算方式,重载方法默认为GeoDistanceType.Plane
|
||||||
* @param geoPoints 多边形坐标点数组
|
* @param geoPoints 多边形坐标点数组
|
||||||
* @return wrapper
|
* @return wrapper
|
||||||
*/
|
*/
|
||||||
default Children orderByDistanceDesc(R column, DistanceUnit unit, GeoDistanceType geoDistance, GeoLocation... geoPoints) {
|
default Children orderByDistanceDesc(R column, DistanceUnit unit, GeoDistanceType geoDistanceType, GeoLocation... geoPoints) {
|
||||||
return orderByDistanceDesc(true, FieldUtils.getFieldName(column), unit, geoDistance, geoPoints);
|
return orderByDistanceDesc(true, FieldUtils.getFieldName(column), unit, geoDistanceType, geoPoints);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -529,7 +529,7 @@ public interface Func<Children, R> extends Serializable {
|
|||||||
* @return wrapper
|
* @return wrapper
|
||||||
*/
|
*/
|
||||||
default Children orderByDistanceDesc(String column, double lat, double lon) {
|
default Children orderByDistanceDesc(String column, double lat, double lon) {
|
||||||
return orderByDistanceDesc(true, column, DistanceUnit.Meters, GeoDistanceType.Plane, GeoUtils.create(lat, lon));
|
return orderByDistanceDesc(true, column, DistanceUnit.Kilometers, GeoDistanceType.Plane, GeoUtils.create(lat, lon));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -549,13 +549,13 @@ public interface Func<Children, R> extends Serializable {
|
|||||||
* 地理位置坐标点由近及远排序
|
* 地理位置坐标点由近及远排序
|
||||||
*
|
*
|
||||||
* @param column 列名 字符串
|
* @param column 列名 字符串
|
||||||
* @param geoDistance 距离计算方式,重载方法默认为GeoDistanceType.Plane
|
* @param geoDistanceType 距离计算方式,重载方法默认为GeoDistanceType.Plane
|
||||||
* @param lat 纬度
|
* @param lat 纬度
|
||||||
* @param lon 经度
|
* @param lon 经度
|
||||||
* @return wrapper
|
* @return wrapper
|
||||||
*/
|
*/
|
||||||
default Children orderByDistanceDesc(String column, GeoDistanceType geoDistance, double lat, double lon) {
|
default Children orderByDistanceDesc(String column, GeoDistanceType geoDistanceType, double lat, double lon) {
|
||||||
return orderByDistanceDesc(true, column, DistanceUnit.Meters, geoDistance, GeoUtils.create(lat, lon));
|
return orderByDistanceDesc(true, column, DistanceUnit.Kilometers, geoDistanceType, GeoUtils.create(lat, lon));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -563,13 +563,13 @@ public interface Func<Children, R> extends Serializable {
|
|||||||
*
|
*
|
||||||
* @param column 列名 字符串
|
* @param column 列名 字符串
|
||||||
* @param unit 距离单位
|
* @param unit 距离单位
|
||||||
* @param geoDistance 距离计算方式,重载方法默认为GeoDistanceType.Plane
|
* @param geoDistanceType 距离计算方式,重载方法默认为GeoDistanceType.Plane
|
||||||
* @param lat 纬度
|
* @param lat 纬度
|
||||||
* @param lon 经度
|
* @param lon 经度
|
||||||
* @return wrapper
|
* @return wrapper
|
||||||
*/
|
*/
|
||||||
default Children orderByDistanceDesc(String column, DistanceUnit unit, GeoDistanceType geoDistance, double lat, double lon) {
|
default Children orderByDistanceDesc(String column, DistanceUnit unit, GeoDistanceType geoDistanceType, double lat, double lon) {
|
||||||
return orderByDistanceDesc(true, column, unit, geoDistance, GeoUtils.create(lat, lon));
|
return orderByDistanceDesc(true, column, unit, geoDistanceType, GeoUtils.create(lat, lon));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -580,7 +580,7 @@ public interface Func<Children, R> extends Serializable {
|
|||||||
* @return wrapper
|
* @return wrapper
|
||||||
*/
|
*/
|
||||||
default Children orderByDistanceDesc(String column, GeoLocation... geoPoints) {
|
default Children orderByDistanceDesc(String column, GeoLocation... geoPoints) {
|
||||||
return orderByDistanceDesc(true, column, DistanceUnit.Meters, GeoDistanceType.Plane, geoPoints);
|
return orderByDistanceDesc(true, column, DistanceUnit.Kilometers, GeoDistanceType.Plane, geoPoints);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -599,12 +599,12 @@ public interface Func<Children, R> extends Serializable {
|
|||||||
* 地理位置坐标点由近及远排序
|
* 地理位置坐标点由近及远排序
|
||||||
*
|
*
|
||||||
* @param column 列名 字符串
|
* @param column 列名 字符串
|
||||||
* @param geoDistance 距离计算方式,重载方法默认为GeoDistanceType.Plane
|
* @param geoDistanceType 距离计算方式,重载方法默认为GeoDistanceType.Plane
|
||||||
* @param geoPoints 多边形坐标点数组
|
* @param geoPoints 多边形坐标点数组
|
||||||
* @return wrapper
|
* @return wrapper
|
||||||
*/
|
*/
|
||||||
default Children orderByDistanceDesc(String column, GeoDistanceType geoDistance, GeoLocation... geoPoints) {
|
default Children orderByDistanceDesc(String column, GeoDistanceType geoDistanceType, GeoLocation... geoPoints) {
|
||||||
return orderByDistanceDesc(true, column, DistanceUnit.Meters, geoDistance, geoPoints);
|
return orderByDistanceDesc(true, column, DistanceUnit.Kilometers, geoDistanceType, geoPoints);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -612,12 +612,12 @@ public interface Func<Children, R> extends Serializable {
|
|||||||
*
|
*
|
||||||
* @param column 列名 字符串
|
* @param column 列名 字符串
|
||||||
* @param unit 距离单位
|
* @param unit 距离单位
|
||||||
* @param geoDistance 距离计算方式,重载方法默认为GeoDistanceType.Plane
|
* @param geoDistanceType 距离计算方式,重载方法默认为GeoDistanceType.Plane
|
||||||
* @param geoPoints 多边形坐标点数组
|
* @param geoPoints 多边形坐标点数组
|
||||||
* @return wrapper
|
* @return wrapper
|
||||||
*/
|
*/
|
||||||
default Children orderByDistanceDesc(String column, DistanceUnit unit, GeoDistanceType geoDistance, GeoLocation... geoPoints) {
|
default Children orderByDistanceDesc(String column, DistanceUnit unit, GeoDistanceType geoDistanceType, GeoLocation... geoPoints) {
|
||||||
return orderByDistanceDesc(true, column, unit, geoDistance, geoPoints);
|
return orderByDistanceDesc(true, column, unit, geoDistanceType, geoPoints);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -626,11 +626,11 @@ public interface Func<Children, R> extends Serializable {
|
|||||||
* @param condition 条件
|
* @param condition 条件
|
||||||
* @param column 列名 字符串
|
* @param column 列名 字符串
|
||||||
* @param unit 距离单位 重载方法默认为km
|
* @param unit 距离单位 重载方法默认为km
|
||||||
* @param geoDistance 距离计算方式,重载方法默认为GeoDistanceType.Plane
|
* @param geoDistanceType 距离计算方式,重载方法默认为GeoDistanceType.Plane
|
||||||
* @param geoPoints 多边形坐标点数组
|
* @param geoPoints 多边形坐标点数组
|
||||||
* @return wrapper
|
* @return wrapper
|
||||||
*/
|
*/
|
||||||
Children orderByDistanceDesc(boolean condition, String column, DistanceUnit unit, GeoDistanceType geoDistance, GeoLocation... geoPoints);
|
Children orderByDistanceDesc(boolean condition, String column, DistanceUnit unit, GeoDistanceType geoDistanceType, GeoLocation... geoPoints);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 字段 IN
|
* 字段 IN
|
||||||
|
|||||||
@ -220,7 +220,7 @@ public interface Geo<Children, R> extends Serializable {
|
|||||||
* @return wrapper
|
* @return wrapper
|
||||||
*/
|
*/
|
||||||
default Children geoDistance(R column, Double distance, GeoLocation centralGeoLocation) {
|
default Children geoDistance(R column, Double distance, GeoLocation centralGeoLocation) {
|
||||||
return geoDistance(true, column, distance, DistanceUnit.Meters, centralGeoLocation, DEFAULT_BOOST);
|
return geoDistance(true, column, distance, DistanceUnit.Kilometers, centralGeoLocation, DEFAULT_BOOST);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -315,7 +315,7 @@ public interface Geo<Children, R> extends Serializable {
|
|||||||
* @return wrapper
|
* @return wrapper
|
||||||
*/
|
*/
|
||||||
default Children geoDistance(String column, Double distance, GeoLocation centralGeoLocation) {
|
default Children geoDistance(String column, Double distance, GeoLocation centralGeoLocation) {
|
||||||
return geoDistance(true, column, distance, DistanceUnit.Meters, centralGeoLocation, DEFAULT_BOOST);
|
return geoDistance(true, column, distance, DistanceUnit.Kilometers, centralGeoLocation, DEFAULT_BOOST);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -418,7 +418,7 @@ public abstract class AbstractWrapper<T, R, Children extends AbstractWrapper<T,
|
|||||||
.orderTypeEnum(OrderTypeEnum.GEO)
|
.orderTypeEnum(OrderTypeEnum.GEO)
|
||||||
.geoPoints(Arrays.asList(geoPoints))
|
.geoPoints(Arrays.asList(geoPoints))
|
||||||
.unit(unit)
|
.unit(unit)
|
||||||
.geoDistance(geoDistance)
|
.geoDistanceType(geoDistance)
|
||||||
.build();
|
.build();
|
||||||
baseSortParams.add(baseSortParam);
|
baseSortParams.add(baseSortParam);
|
||||||
}
|
}
|
||||||
@ -436,7 +436,7 @@ public abstract class AbstractWrapper<T, R, Children extends AbstractWrapper<T,
|
|||||||
.orderTypeEnum(OrderTypeEnum.GEO)
|
.orderTypeEnum(OrderTypeEnum.GEO)
|
||||||
.geoPoints(Arrays.asList(geoPoints))
|
.geoPoints(Arrays.asList(geoPoints))
|
||||||
.unit(unit)
|
.unit(unit)
|
||||||
.geoDistance(geoDistance)
|
.geoDistanceType(geoDistance)
|
||||||
.build();
|
.build();
|
||||||
baseSortParams.add(baseSortParam);
|
baseSortParams.add(baseSortParam);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -229,10 +229,14 @@ public class WrapperProcessor {
|
|||||||
case GEO_DISTANCE:
|
case GEO_DISTANCE:
|
||||||
realField = getRealField(param.getColumn(), mappingColumnMap);
|
realField = getRealField(param.getColumn(), mappingColumnMap);
|
||||||
query = Query.of(q -> q.geoDistance(p -> {
|
query = Query.of(q -> q.geoDistance(p -> {
|
||||||
p.field(realField).location((GeoLocation) param.getExt2()).boost(param.getBoost());
|
String unit = param.getExt1() == null ? DistanceUnit.Kilometers.jsonValue() : ((DistanceUnit) param.getExt1()).jsonValue();
|
||||||
String unit = param.getExt1() == null ? DistanceUnit.Meters.jsonValue() : ((DistanceUnit) param.getExt1()).jsonValue();
|
|
||||||
Double distance = (Double) param.getVal();
|
Double distance = (Double) param.getVal();
|
||||||
p.distance(distance + unit);
|
p.boost(param.getBoost())
|
||||||
|
.field(realField)
|
||||||
|
.location((GeoLocation) param.getExt2())
|
||||||
|
.distance(distance + unit)
|
||||||
|
.distanceType(GeoDistanceType.Arc)
|
||||||
|
.validationMethod(GeoValidationMethod.Strict);
|
||||||
return p;
|
return p;
|
||||||
}));
|
}));
|
||||||
setBool(bool, query, param.getPrevQueryType());
|
setBool(bool, query, param.getPrevQueryType());
|
||||||
@ -255,8 +259,8 @@ public class WrapperProcessor {
|
|||||||
.field(realField)
|
.field(realField)
|
||||||
.shape(x -> x
|
.shape(x -> x
|
||||||
// .shape(JsonData.of(WellKnownText.toWKT(val)))
|
// .shape(JsonData.of(WellKnownText.toWKT(val)))
|
||||||
.shape(JsonData.of(GeoUtils.toMap((Geometry) param.getVal())))
|
.shape(JsonData.of(GeoUtils.toMap((Geometry) param.getVal())))
|
||||||
.relation((GeoShapeRelation) param.getExt1())
|
.relation((GeoShapeRelation) param.getExt1())
|
||||||
)
|
)
|
||||||
.boost(param.getBoost())
|
.boost(param.getBoost())
|
||||||
.build()._toQuery();
|
.build()._toQuery();
|
||||||
@ -279,7 +283,7 @@ public class WrapperProcessor {
|
|||||||
realField = getRealField(param.getColumn(), mappingColumnMap);
|
realField = getRealField(param.getColumn(), mappingColumnMap);
|
||||||
String[] split = param.getColumn().split(SIGN);
|
String[] split = param.getColumn().split(SIGN);
|
||||||
String path = split[split.length - 1];
|
String path = split[split.length - 1];
|
||||||
query = Query.of(b -> b.bool( x -> getBool(children, x, entityInfo, path)));
|
query = Query.of(b -> b.bool(x -> getBool(children, x, entityInfo, path)));
|
||||||
NestedQuery.Builder nestedQueryBuilder = QueryBuilders.nested().path(realField).query(query).scoreMode((ChildScoreMode) param.getVal());
|
NestedQuery.Builder nestedQueryBuilder = QueryBuilders.nested().path(realField).query(query).scoreMode((ChildScoreMode) param.getVal());
|
||||||
// 设置嵌套类型高亮查询参数
|
// 设置嵌套类型高亮查询参数
|
||||||
setNestedHighlight(path, param.getColumn(), nestedQueryBuilder, entityInfo);
|
setNestedHighlight(path, param.getColumn(), nestedQueryBuilder, entityInfo);
|
||||||
@ -308,8 +312,7 @@ public class WrapperProcessor {
|
|||||||
.type(realField)
|
.type(realField)
|
||||||
.query(query)
|
.query(query)
|
||||||
.minChildren(1)
|
.minChildren(1)
|
||||||
.scoreMode((ChildScoreMode) param.getVal())
|
.scoreMode((ChildScoreMode) param.getVal());
|
||||||
;
|
|
||||||
setBool(bool, Query.of(x -> x.hasChild(hasChildQueryBuilder.build())), param.getPrevQueryType());
|
setBool(bool, Query.of(x -> x.hasChild(hasChildQueryBuilder.build())), param.getPrevQueryType());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -627,7 +630,7 @@ public class WrapperProcessor {
|
|||||||
.field(realField)
|
.field(realField)
|
||||||
.location(baseSortParam.getGeoPoints())
|
.location(baseSortParam.getGeoPoints())
|
||||||
.order(baseSortParam.getSortOrder())
|
.order(baseSortParam.getSortOrder())
|
||||||
.distanceType(baseSortParam.getGeoDistance())
|
.distanceType(baseSortParam.getGeoDistanceType())
|
||||||
.unit(baseSortParam.getUnit())
|
.unit(baseSortParam.getUnit())
|
||||||
));
|
));
|
||||||
case CUSTOMIZE:
|
case CUSTOMIZE:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user