|
@@ -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 ");
|