|
@ -51,7 +51,7 @@ public class Searcher { |
|
|
// 当前页的结束条数(不能包含)
|
|
|
// 当前页的结束条数(不能包含)
|
|
|
int end = start + pageSize; |
|
|
int end = start + pageSize; |
|
|
// 创建排序对象,需要排序字段SortField,参数:字段的名称、字段的类型、是否反转如果是false,升序。true降序
|
|
|
// 创建排序对象,需要排序字段SortField,参数:字段的名称、字段的类型、是否反转如果是false,升序。true降序
|
|
|
Sort sort = new Sort(new SortField(LogMessageConstant.SORT_NAME, SortField.Type.LONG, true)); |
|
|
Sort sort = new Sort(new SortField(LogMessageConstant.FIELD_SORT_NAME, SortField.Type.LONG, true)); |
|
|
|
|
|
|
|
|
TopDocs docs = null; |
|
|
TopDocs docs = null; |
|
|
BooleanQuery.Builder booleanQueryBuilder = new BooleanQuery.Builder(); |
|
|
BooleanQuery.Builder booleanQueryBuilder = new BooleanQuery.Builder(); |
|
@ -86,6 +86,12 @@ public class Searcher { |
|
|
whereJson.getString(LogMessageConstant.FIELD_TRACEID).trim())); |
|
|
whereJson.getString(LogMessageConstant.FIELD_TRACEID).trim())); |
|
|
booleanQueryBuilder.add(termQuery, BooleanClause.Occur.MUST); |
|
|
booleanQueryBuilder.add(termQuery, BooleanClause.Occur.MUST); |
|
|
} |
|
|
} |
|
|
|
|
|
if (ObjectUtil.isNotEmpty(whereJson.get(LogMessageConstant.FIELD_LABEL))) { |
|
|
|
|
|
//查询解析器
|
|
|
|
|
|
TermQuery termQuery = new TermQuery(new Term(LogMessageConstant.FIELD_LABEL, |
|
|
|
|
|
whereJson.getString(LogMessageConstant.FIELD_LABEL).trim())); |
|
|
|
|
|
booleanQueryBuilder.add(termQuery, BooleanClause.Occur.MUST); |
|
|
|
|
|
} |
|
|
if (ObjectUtil.isNotEmpty(whereJson.get(LogMessageConstant.FIELD_LEVEL))) { |
|
|
if (ObjectUtil.isNotEmpty(whereJson.get(LogMessageConstant.FIELD_LEVEL))) { |
|
|
//查询解析器
|
|
|
//查询解析器
|
|
|
TermQuery termQuery = new TermQuery(new Term(LogMessageConstant.FIELD_LEVEL, |
|
|
TermQuery termQuery = new TermQuery(new Term(LogMessageConstant.FIELD_LEVEL, |
|
@ -101,9 +107,9 @@ public class Searcher { |
|
|
|
|
|
|
|
|
for (ScoreDoc scoreDoc : scoreDocs) { |
|
|
for (ScoreDoc scoreDoc : scoreDocs) { |
|
|
Document doc = reader.document(scoreDoc.doc); |
|
|
Document doc = reader.document(scoreDoc.doc); |
|
|
String logInfo = LogMessageConstant.COLOR_CYAN + doc.get(LogMessageConstant.LABEL) + |
|
|
String logInfo = LogMessageConstant.COLOR_CYAN + doc.get(LogMessageConstant.FIELD_LABEL) + |
|
|
LogMessageConstant.COLOR_RESET + " - " + |
|
|
LogMessageConstant.COLOR_RESET + " - " + |
|
|
LogMessageConstant.COLOR_BLUE + doc.get(LogMessageConstant.IP) + |
|
|
LogMessageConstant.COLOR_BLUE + doc.get(LogMessageConstant.FIELD_IP) + |
|
|
LogMessageConstant.COLOR_RESET + " - " + |
|
|
LogMessageConstant.COLOR_RESET + " - " + |
|
|
LogMessageConstant.COLOR_YELLOW + doc.get(LogMessageConstant.FIELD_TRACEID) + |
|
|
LogMessageConstant.COLOR_YELLOW + doc.get(LogMessageConstant.FIELD_TRACEID) + |
|
|
LogMessageConstant.COLOR_RESET + " - " + |
|
|
LogMessageConstant.COLOR_RESET + " - " + |
|
|