|
@@ -77,6 +77,7 @@ public class EsDenseVectorService {
|
|
|
public Records getPatentVectors(EsPatentVectorDTO dto,File file) throws Exception {
|
|
|
Long pageNum = dto.getPageNum();
|
|
|
Long pageSize = dto.getPageSize();
|
|
|
+ Boolean ifAddSearchRecord = dto.getIfAddSearchRecord();
|
|
|
|
|
|
SearchRequest.Builder builder = new SearchRequest.Builder();
|
|
|
//设置查询索引
|
|
@@ -157,22 +158,24 @@ public class EsDenseVectorService {
|
|
|
long count = total <= vectorVos.size() ? total : vectorVos.size();
|
|
|
records.setTotal(count);
|
|
|
|
|
|
- //添加检索历史
|
|
|
- AddSearchRecordDTO recordDTO = new AddSearchRecordDTO();
|
|
|
- if (dto.getProductId() != null) {
|
|
|
- recordDTO.setProductId(dto.getProductId());
|
|
|
- Product product = productMapper.selectById(dto.getProductId());
|
|
|
- recordDTO.setSearchCondition(product.getName());
|
|
|
- } else {
|
|
|
- recordDTO.setSearchCondition(dto.getKey());
|
|
|
- }
|
|
|
- recordDTO.setDescription(dto.getDescription());
|
|
|
- if (!CollectionUtils.isEmpty(getGuids)) {
|
|
|
- recordDTO.setGuid(getGuids.get(0));
|
|
|
+ if (Boolean.TRUE.equals(ifAddSearchRecord)) {
|
|
|
+ //添加检索历史
|
|
|
+ AddSearchRecordDTO recordDTO = new AddSearchRecordDTO();
|
|
|
+ if (dto.getProductId() != null) {
|
|
|
+ recordDTO.setProductId(dto.getProductId());
|
|
|
+ Product product = productMapper.selectById(dto.getProductId());
|
|
|
+ recordDTO.setSearchCondition(product.getName());
|
|
|
+ } else {
|
|
|
+ recordDTO.setSearchCondition(dto.getKey());
|
|
|
+ }
|
|
|
+ recordDTO.setDescription(dto.getDescription());
|
|
|
+ if (!CollectionUtils.isEmpty(getGuids)) {
|
|
|
+ recordDTO.setGuid(getGuids.get(0));
|
|
|
+ }
|
|
|
+ recordDTO.setAllNum(Integer.parseInt(String.valueOf(count)));
|
|
|
+ recordDTO.setSearchTime(new Date());
|
|
|
+ searchRecordService.addSearchRecord(recordDTO);
|
|
|
}
|
|
|
- recordDTO.setAllNum(Integer.parseInt(String.valueOf(count)));
|
|
|
- recordDTO.setSearchTime(new Date());
|
|
|
- searchRecordService.addSearchRecord(recordDTO);
|
|
|
return records;
|
|
|
}
|
|
|
|