|
@@ -17,6 +17,7 @@ import com.example.xiaoshiweixinback.business.common.base.Records;
|
|
|
import com.example.xiaoshiweixinback.business.common.base.RedisConf;
|
|
|
import com.example.xiaoshiweixinback.business.redis.RedisService;
|
|
|
import com.example.xiaoshiweixinback.business.utils.BeanUtil;
|
|
|
+import com.example.xiaoshiweixinback.business.utils.RegexUtil;
|
|
|
import com.example.xiaoshiweixinback.business.utils.parseQueryToTree.expressManager;
|
|
|
import com.example.xiaoshiweixinback.business.utils.parseQueryToTree.operateNode;
|
|
|
import com.example.xiaoshiweixinback.business.utils.parseQueryToTree.treeNode;
|
|
@@ -223,7 +224,7 @@ public class EsDenseVectorService {
|
|
|
builder.index("patent_vector");
|
|
|
Query query = QueryBuilders.term(i -> i.field("app_no").value(noDTO.getAppNo()));
|
|
|
builder.query(query);
|
|
|
- builder.size(100);
|
|
|
+ builder.size(30);
|
|
|
SearchResponse<PatentVector> response = client.search(builder.build(), PatentVector.class);
|
|
|
List<Hit<PatentVector>> hits = response.hits().hits();
|
|
|
for (Hit<PatentVector> hit : hits) {
|
|
@@ -290,42 +291,25 @@ public class EsDenseVectorService {
|
|
|
} else {
|
|
|
condition = searchCondition;
|
|
|
}
|
|
|
-// if (StringUtils.isNotEmpty(searchCondition)) {
|
|
|
-// if (StringUtils.isNotEmpty(keyword)) {
|
|
|
-// String key = keyword.replaceAll("[,。、;,./;]", " OR ");
|
|
|
-// condition = "TI = " + "(" + "\"" + key + "\"" + ")" + " AND " + searchCondition;
|
|
|
-// } else {
|
|
|
-// condition = searchCondition;
|
|
|
-// }
|
|
|
-// } else {
|
|
|
-// //获取关键词
|
|
|
-// if (StringUtils.isNotEmpty(keyword)) {
|
|
|
-//// String key = dto.getKey().replaceAll("[,。、;,./;\\s]"," OR ");
|
|
|
-// String key = keyword.replaceAll("[,。、;,./;]", " OR ");
|
|
|
-// condition = "TI = " + "(" + "\"" + key + "\"" + ")";
|
|
|
-// }
|
|
|
-// }
|
|
|
return condition;
|
|
|
}
|
|
|
|
|
|
public String appendStr(String str) {
|
|
|
- String needStr = "";
|
|
|
- String cName = str.replaceAll("[,。、;,./;]+|\\s+", "OR");
|
|
|
- if (cName.contains("OR")) {
|
|
|
- String[] split = cName.split("OR");
|
|
|
- String ccName = "";
|
|
|
- for (int i = 0; i < split.length; i++) {
|
|
|
- String s = split[i];
|
|
|
- if (split.length - 1 != i) {
|
|
|
- ccName = ccName + "\"" + s + "\"" + " OR ";
|
|
|
+ String s = "";
|
|
|
+ List<String> delimiters = RegexUtil.splitByDelimiters(str);
|
|
|
+ if (delimiters.size() > 1) {
|
|
|
+ for (int i = 0; i < delimiters.size(); i++) {
|
|
|
+ String value = delimiters.get(i);
|
|
|
+ if (delimiters.size() - 1 != i) {
|
|
|
+ s = s + "\"" + value + "\"" + " OR ";
|
|
|
} else {
|
|
|
- ccName = ccName + "\"" + s + "\"";
|
|
|
+ s = s + "\"" + value + "\"";
|
|
|
}
|
|
|
}
|
|
|
- needStr = ccName;
|
|
|
} else {
|
|
|
- needStr = "\"" + str + "\"";
|
|
|
+ s = "\"" + str + "\"";
|
|
|
}
|
|
|
- return needStr;
|
|
|
+ return s;
|
|
|
}
|
|
|
+
|
|
|
}
|