ソースを参照

fixed esDenseVector

zero 1 年間 前
コミット
925c04503f

+ 4 - 0
src/main/java/com/example/xiaoshiweixinback/entity/dto/esPicture/EsPatentVectorDTO.java

@@ -11,6 +11,10 @@ public class EsPatentVectorDTO {
 
     private String key;
 
+    private String appCountry;
+
+    private String name;
+
     private String description;
 
     private Long pageNum;

+ 3 - 0
src/main/java/com/example/xiaoshiweixinback/entity/dto/patent/SelectPatentDTO.java

@@ -25,4 +25,7 @@ public class SelectPatentDTO {
     //专利号
     private List<String> appNos;
 
+    private String appCountry;
+
+    private String name;
 }

+ 25 - 4
src/main/java/com/example/xiaoshiweixinback/service/importPatent/EsDenseVectorService.java

@@ -83,7 +83,7 @@ public class EsDenseVectorService {
         //设置查询索引
         builder.index("patent_vector");
         Query q = null;
-        String condition = this.appendCondition(dto.getProductId(), dto.getKey());
+        String condition = this.appendCondition(dto.getProductId(), dto.getKey(),dto.getAppCountry(),dto.getName());
         if (StringUtils.isNotEmpty(condition)) {
             //1. 解析检索条件
             treeNode tree = expressManager.getInstance().Parse(condition, false);
@@ -140,8 +140,15 @@ public class EsDenseVectorService {
         List<EsPatentVectorVo> vectorVos = new ArrayList<>();
         Double fixedScore = 1.7d;
         for (Hit<PatentVector> hit : hits) {
-            Double score = hit.score();
-            if (score > fixedScore) {
+            if (!CollectionUtils.isEmpty(imageList)) {
+                Double score = hit.score();
+                if (score > fixedScore) {
+                    PatentVector vector = hit.source();
+                    EsPatentVectorVo vectorVo = new EsPatentVectorVo();
+                    BeanUtil.copy(vector, vectorVo);
+                    vectorVos.add(vectorVo);
+                }
+            } else {
                 PatentVector vector = hit.source();
                 EsPatentVectorVo vectorVo = new EsPatentVectorVo();
                 BeanUtil.copy(vector, vectorVo);
@@ -213,7 +220,7 @@ public class EsDenseVectorService {
      * @return
      * @throws Exception
      */
-    public String appendCondition(Integer productId, String keyword) {
+    public String appendCondition(Integer productId, String keyword,String appCountry,String name) {
         SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
         SimpleDateFormat format1 = new SimpleDateFormat("yyyy");
 
@@ -234,6 +241,20 @@ public class EsDenseVectorService {
             String s = agoFormat + "~" + nowFormat;
             searchCondition = searchCondition + " AND " + "AD = " + "(" + s + ")";
         }
+        if (StringUtils.isNotEmpty(appCountry)) {
+            if (StringUtils.isEmpty(searchCondition)) {
+                searchCondition = "CO = " + "(" + appCountry + ")";
+            } else {
+                searchCondition = searchCondition + " AND " + "CO = " + "(" + appCountry + ")";
+            }
+        }
+        if (StringUtils.isNotEmpty(name)) {
+            if (StringUtils.isEmpty(searchCondition)) {
+                searchCondition = "PE = " + "(" + name + ")";
+            } else {
+                searchCondition = searchCondition + " AND " + "PE = " + "(" + name + ")";
+            }
+        }
         if (StringUtils.isNotEmpty(searchCondition)) {
             if (StringUtils.isNotEmpty(keyword)) {
                 String key = keyword.replaceAll("[,。、;,./;]", " OR ");

+ 1 - 1
src/main/java/com/example/xiaoshiweixinback/service/importPatent/EsPatentService.java

@@ -362,7 +362,7 @@ public class EsPatentService {
         //设置查询索引
         builder.index("patent_vector");
         Query q = null;
-        String condition = esDenseVectorService.appendCondition(patentDTO.getProductId(), patentDTO.getKey());
+        String condition = esDenseVectorService.appendCondition(patentDTO.getProductId(), patentDTO.getKey(), patentDTO.getAppCountry(), patentDTO.getName());
         if (StringUtils.isNotEmpty(condition)) {
             //1. 解析检索条件
             treeNode tree = expressManager.getInstance().Parse(condition, false);

+ 15 - 0
src/main/resources/jsons/patentVector.json

@@ -104,5 +104,20 @@
     "ifShow": "false",
     "ifStats": "false",
     "ifAsCondition": "true"
+  },
+  {
+    "name": "权利人",
+    "type": "Array",
+    "value": "rightHolder",
+    "field": "PE",
+    "esField": "right_holder.name.key",
+    "esClass": "nestedPersonQueryBuilder",
+    "ifSearch": "true",
+    "ifGroup": "true",
+    "ifShow": "true",
+    "ifStats": "true",
+    "ifAsCondition": "true",
+    "groupBy": "company",
+    "ifSort": "false"
   }
 ]