From a6fb6779c71f8a7e62e435b29694dde8931da850 Mon Sep 17 00:00:00 2001 From: "583641232@qq.com" <583641232@qq.com> Date: Wed, 31 Jul 2024 11:53:41 +0800 Subject: [PATCH] =?UTF-8?q?:sparkles:=20=E6=8C=87=E5=AE=9A=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/application-dev.yml | 2 +- .../src/main/resources/application-prod.yml | 2 +- .../domain/CollectionInformation.java | 14 +++++++------- .../impl/CollectionInformationServiceImpl.java | 18 ++++++++---------- 4 files changed, 17 insertions(+), 19 deletions(-) diff --git a/cas-admin/src/main/resources/application-dev.yml b/cas-admin/src/main/resources/application-dev.yml index bff05dc..258a4d7 100644 --- a/cas-admin/src/main/resources/application-dev.yml +++ b/cas-admin/src/main/resources/application-dev.yml @@ -82,6 +82,6 @@ easy-es: address: 192.168.3.20:9200 #es的连接地址,必须含端口 若为集群,则可以用逗号隔开 例如:127.0.0.1:9200,127.0.0.2:9200 global-config: distributed: false - print-dsl: false + print-dsl: true password: ly123456 username: elastic diff --git a/cas-admin/src/main/resources/application-prod.yml b/cas-admin/src/main/resources/application-prod.yml index 38d5a70..a7b8070 100644 --- a/cas-admin/src/main/resources/application-prod.yml +++ b/cas-admin/src/main/resources/application-prod.yml @@ -86,4 +86,4 @@ easy-es: address: localhost:9200 #es的连接地址,必须含端口 若为集群,则可以用逗号隔开 例如:127.0.0.1:9200,127.0.0.2:9200 global-config: distributed: false - print-dsl: false + print-dsl: true diff --git a/cas-system/src/main/java/com/inscloudtech/datacenter/domain/CollectionInformation.java b/cas-system/src/main/java/com/inscloudtech/datacenter/domain/CollectionInformation.java index 79c5b1c..f5765a6 100644 --- a/cas-system/src/main/java/com/inscloudtech/datacenter/domain/CollectionInformation.java +++ b/cas-system/src/main/java/com/inscloudtech/datacenter/domain/CollectionInformation.java @@ -41,7 +41,7 @@ public class CollectionInformation extends BaseEntity { @UpdateValueLog(fieldName = "信息来源") @DeduplicationField @ExcelProperty("信息来源") - @IndexField(fieldType = FieldType.KEYWORD_TEXT, analyzer = "ngram_analyzer") + @IndexField(fieldType = FieldType.KEYWORD) private String informationSources ; @@ -51,7 +51,7 @@ public class CollectionInformation extends BaseEntity { @UpdateValueLog(fieldName = "主体名称") @DeduplicationField @ExcelProperty("主体名称") - @IndexField(fieldType = FieldType.KEYWORD_TEXT, analyzer = "ngram_analyzer") + @IndexField(fieldType = FieldType.KEYWORD) private String name; @@ -61,7 +61,7 @@ public class CollectionInformation extends BaseEntity { @ExcelProperty("基础信息") @DeduplicationField @UpdateValueLog(fieldName = "基础信息") - @IndexField(fieldType = FieldType.KEYWORD_TEXT, analyzer = "ngram_analyzer") + @IndexField(fieldType = FieldType.KEYWORD) private String basicInfo; @@ -71,7 +71,7 @@ public class CollectionInformation extends BaseEntity { @ExcelProperty("关系信息") @UpdateValueLog(fieldName = "关系信息") @DeduplicationField - @IndexField(fieldType = FieldType.KEYWORD_TEXT, analyzer = "ngram_analyzer") + @IndexField(fieldType = FieldType.KEYWORD) private String relationInfo; @@ -81,7 +81,7 @@ public class CollectionInformation extends BaseEntity { @ExcelProperty("财产信息") @UpdateValueLog(fieldName = "财产信息") @DeduplicationField - @IndexField(fieldType = FieldType.KEYWORD_TEXT, analyzer = "ngram_analyzer") + @IndexField(fieldType = FieldType.KEYWORD) private String assetsInfo; /** @@ -90,7 +90,7 @@ public class CollectionInformation extends BaseEntity { @ExcelProperty("行为信息") @DeduplicationField @UpdateValueLog(fieldName = "行为信息") - @IndexField(fieldType = FieldType.KEYWORD_TEXT, analyzer = "ngram_analyzer") + @IndexField(fieldType = FieldType.KEYWORD) private String actionInfo; /** @@ -99,7 +99,7 @@ public class CollectionInformation extends BaseEntity { @UpdateValueLog(fieldName = "其他事项") @ExcelProperty("其他事项") @DeduplicationField - @IndexField(fieldType = FieldType.KEYWORD_TEXT, analyzer = "ngram_analyzer") + @IndexField(fieldType = FieldType.KEYWORD) @TableField(updateStrategy = FieldStrategy.IGNORED) private String remark; diff --git a/cas-system/src/main/java/com/inscloudtech/datacenter/service/impl/CollectionInformationServiceImpl.java b/cas-system/src/main/java/com/inscloudtech/datacenter/service/impl/CollectionInformationServiceImpl.java index e81d953..a543e71 100644 --- a/cas-system/src/main/java/com/inscloudtech/datacenter/service/impl/CollectionInformationServiceImpl.java +++ b/cas-system/src/main/java/com/inscloudtech/datacenter/service/impl/CollectionInformationServiceImpl.java @@ -148,16 +148,14 @@ public class CollectionInformationServiceImpl implements CollectionInformationSe // lqw.multiMatchQuery(keyword, CollectionInformation::getInformationSources, CollectionInformation::getName, // CollectionInformation::getBasicInfo,CollectionInformation::getRelationInfo,CollectionInformation::getAssetsInfo, // CollectionInformation::getActionInfo,CollectionInformation::getRemark); - lqw.like(CollectionInformation::getInformationSources, keyword); - -// lqw.or().like(CollectionInformation::getName, keyword); -// lqw.or().like(CollectionInformation::getBasicInfo, keyword); -// lqw.or().like(CollectionInformation::getRelationInfo, keyword); -// lqw.or().like(CollectionInformation::getAssetsInfo, keyword); -// lqw.or().like(CollectionInformation::getActionInfo, keyword); -// lqw.or().like( CollectionInformation::getRemark, keyword); - - + lqw.and(lq -> lq.or().like(CollectionInformation::getInformationSources, keyword) + .or().like(CollectionInformation::getName, keyword) + .or().like(CollectionInformation::getBasicInfo, keyword) + .or().like(CollectionInformation::getRelationInfo, keyword) + .or().like(CollectionInformation::getAssetsInfo, keyword) + .or().like(CollectionInformation::getActionInfo, keyword) + .or().like(CollectionInformation::getRemark, keyword) + ); } return lqw; }