修复:综合浏览点击搜索推荐时检索结果不对的问题

master
guoxin 1 year ago
parent b18528eb54
commit 82a64d8df7
  1. 2
      dbsql/update/update202309.sql
  2. 2
      shandan-browser/src/main/java/com/keyware/shandan/browser/SearchLogProcessor.java
  3. 35
      shandan-browser/src/main/resources/static/js/browser.js

@ -1,3 +1,5 @@
alter table BIANMU.B_DIRECTORY_MEMBERS add APPLY_CHILDREN bit default 0;
comment on column BIANMU.B_DIRECTORY_MEMBERS.APPLY_CHILDREN is '是否应用到子节点';
INSERT INTO BIANMU.SYS_DICT (ID, DICT_CODE, TYPE_ID, DICT_NAME, DICT_VALUE, DICT_DESC, DICT_ORDER, DICT_STATE, CREATE_USER, CREATE_TIME, MODIFY_USER, MODIFY_TIME) VALUES ('1704521247959818242', 'browser_system_words_config', 'PUBLIC_SETTING', '综合浏览系统热词统计周期', '7d', '单位:y=年、m=月、d=天,如:7d=7天', 0, 1, 'admin', '2023-09-20 23:41:48.648000', 'admin', '2023-09-20 23:46:07.325000');

@ -28,6 +28,8 @@ public class SearchLogProcessor extends Thread {
private DateField unit = DateField.DAY_OF_MONTH;
private final Map<String, Integer> systemWords = new HashMap<>();
private final Map<String, Map<String, Integer>> userHistoryWords = new HashMap<>();
public SearchLogProcessor(SysOperateLogService logService) {
this.logService = logService;
}

@ -162,8 +162,9 @@ layui.use(['layer', 'listPage', 'globalTree', 'gtable', 'form', 'element', 'drop
}
const suggest = new SearchSuggest(layui, 'searchKeyInput')
suggest.onClick((text) => {
suggest.onClickItem(function (text) {
setSearchKeyCondition(text, preciseQuery === 'eq' ? 'eq' : 'like');
this.$searchBtn.click();
})
}
},
@ -276,17 +277,17 @@ layui.use(['layer', 'listPage', 'globalTree', 'gtable', 'form', 'element', 'drop
let value = $(this).val();
setSearchKeyCondition(value, preciseQuery === 'eq' ? 'eq' : 'like');
})
}
function setSearchKeyCondition(value, logic) {
let where = metaListTable.where || {};
let conditions = where.conditions || [];
conditions = conditions.filter(item => item.fieldName !== 'metadataName')
if (value && value.trim()) {
conditions.push({fieldName: 'metadataName', fieldValue: value.trim(), logicJudgement: logic})
}
where.conditions = conditions;
metaListTable.where = where;
function setSearchKeyCondition(value, logic) {
let where = metaListTable.where || {};
let conditions = where.conditions || [];
conditions = conditions.filter(item => item.fieldName !== 'metadataName')
if (value && value.trim()) {
conditions.push({fieldName: 'metadataName', fieldValue: value.trim(), logicJudgement: logic})
}
where.conditions = conditions;
metaListTable.where = where;
}
function setMarkTagInputValue() {
@ -488,7 +489,11 @@ layui.use(['layer', 'listPage', 'globalTree', 'gtable', 'form', 'element', 'drop
cols: THeadSetLayer.convertColumns(theadConfig, 'dirFileTable'),
done: () => {
form.val('full-search-form', {queryType});
new SearchSuggest(layui, 'fileSearchKeyInput');
const suggest = new SearchSuggest(layui, 'fileSearchKeyInput');
suggest.onClickItem(function (text) {
$('#fileSearchKeyInput').val(text);
this.$searchBtn.click();
})
}
},
});
@ -574,7 +579,7 @@ class SearchSuggest {
this.$elem.find('ul li').on('click', (event) => {
const $li = $(event.target);
this.$bindElem.val($li.text());
this.$searchBtn.click();
this.onclickItemCallback && this.onclickItemCallback($li.text());
});
this.isHide = false;
}
@ -588,8 +593,8 @@ class SearchSuggest {
this.bindElem();
}
onClick(onclick) {
this.onclick = onclick;
onClickItem(callback) {
this.onclickItemCallback = callback;
}
}