优化日志查询
This commit is contained in:
+2
-4
@@ -38,11 +38,9 @@ public class SlowQueryLogController extends LogController<SlowQueryLog> {
|
|||||||
BoolQueryBuilder builder = QueryBuilders.boolQuery();
|
BoolQueryBuilder builder = QueryBuilders.boolQuery();
|
||||||
String searchKey = (String) params.get("searchKey");
|
String searchKey = (String) params.get("searchKey");
|
||||||
String searchValue = (String) params.get("searchValue");
|
String searchValue = (String) params.get("searchValue");
|
||||||
if (StrUtil.isNotEmpty(searchKey)) {
|
if (StrUtil.isNotEmpty(searchKey) && StrUtil.isNotEmpty(searchValue)) {
|
||||||
if (ES_PARAM_QUERY.equals(searchKey)) {
|
|
||||||
// 模糊查询
|
// 模糊查询
|
||||||
builder.must(QueryBuilders.matchPhraseQuery(ES_PARAM_QUERY, searchValue.toUpperCase()));
|
builder.must(QueryBuilders.matchPhraseQuery(ES_PARAM_QUERY, searchValue));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.getPage(params, builder, logDao);
|
return super.getPage(params, builder, logDao);
|
||||||
|
|||||||
+4
-16
@@ -40,25 +40,13 @@ public class SysLogController extends LogController<SysLog> {
|
|||||||
BoolQueryBuilder builder = QueryBuilders.boolQuery();
|
BoolQueryBuilder builder = QueryBuilders.boolQuery();
|
||||||
String searchKey = (String) params.get("searchKey");
|
String searchKey = (String) params.get("searchKey");
|
||||||
String searchValue = (String) params.get("searchValue");
|
String searchValue = (String) params.get("searchValue");
|
||||||
if (StrUtil.isNotEmpty(searchKey)) {
|
if (StrUtil.isNotEmpty(searchKey) && StrUtil.isNotEmpty(searchValue)) {
|
||||||
if (ES_PARAM_MESSAGE.equals(searchKey)) {
|
|
||||||
// 整词模糊查询 日志信息
|
|
||||||
builder.must(QueryBuilders.matchPhraseQuery(ES_PARAM_MESSAGE, searchValue));
|
|
||||||
}
|
|
||||||
if (ES_PARAM_LOG_LEVEL.equals(searchKey)) {
|
if (ES_PARAM_LOG_LEVEL.equals(searchKey)) {
|
||||||
|
searchValue = searchValue.toUpperCase();
|
||||||
|
}
|
||||||
// 模糊查询
|
// 模糊查询
|
||||||
builder.must(QueryBuilders.matchPhraseQuery(ES_PARAM_LOG_LEVEL, searchValue.toUpperCase()));
|
builder.must(QueryBuilders.matchPhraseQuery(searchKey, searchValue));
|
||||||
}
|
}
|
||||||
if (ES_PARAM_APP_NAME.equals(searchKey)) {
|
|
||||||
// 模糊查询
|
|
||||||
builder.must(QueryBuilders.fuzzyQuery(ES_PARAM_APP_NAME, searchValue));
|
|
||||||
}
|
|
||||||
if (ES_PARAM_CLASSNAME.equals(searchKey)) {
|
|
||||||
// 模糊查询
|
|
||||||
builder.must(QueryBuilders.fuzzyQuery(ES_PARAM_CLASSNAME, searchValue));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return super.getPage(params, builder, logDao);
|
return super.getPage(params, builder, logDao);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user