|
@ -68,15 +68,21 @@ public class Searcher { |
|
|
} |
|
|
} |
|
|
TermRangeQuery termRangeQuery = new TermRangeQuery("logTime", new BytesRef(startDate), new BytesRef(endDate), true, true); |
|
|
TermRangeQuery termRangeQuery = new TermRangeQuery("logTime", new BytesRef(startDate), new BytesRef(endDate), true, true); |
|
|
booleanQueryBuilder.add(termRangeQuery,BooleanClause.Occur.MUST); |
|
|
booleanQueryBuilder.add(termRangeQuery,BooleanClause.Occur.MUST); |
|
|
|
|
|
if (whereJson.get("device_code") != null){ |
|
|
|
|
|
Query termQuery = new TermQuery(new Term("device_code", (String) whereJson.get("device_code"))); |
|
|
|
|
|
booleanQueryBuilder.add(termQuery,BooleanClause.Occur.MUST); |
|
|
|
|
|
} |
|
|
//日志类型
|
|
|
//日志类型
|
|
|
if (whereJson.get("blurry") != null) queryString += "+fieldContent:"+(String) whereJson.get("blurry"); |
|
|
// if (whereJson.get("blurry") != null) queryString += "fieldContent:"+(String) whereJson.get("blurry");
|
|
|
if (whereJson.get("device_code") != null) queryString += " +device_code:"+(String) whereJson.get("device_code"); |
|
|
if (whereJson.get("blurry") != null) queryString = (String) whereJson.get("blurry"); |
|
|
if (whereJson.get("device_code") == null && whereJson.get("blurry") == null) { |
|
|
// if (whereJson.get("device_code") != null) queryString += " +device_code:"+(String) whereJson.get("device_code");
|
|
|
|
|
|
|
|
|
|
|
|
if (whereJson.get("blurry") == null) { |
|
|
WildcardQuery query=new WildcardQuery(new Term("fieldContent","*")); |
|
|
WildcardQuery query=new WildcardQuery(new Term("fieldContent","*")); |
|
|
booleanQueryBuilder.add(query, BooleanClause.Occur.MUST); |
|
|
booleanQueryBuilder.add(query, BooleanClause.Occur.MUST); |
|
|
docs = searcher.search(booleanQueryBuilder.build(), end,sort); |
|
|
docs = searcher.search(booleanQueryBuilder.build(), end,sort); |
|
|
}else { |
|
|
}else { |
|
|
Query query = queryParser.parse(queryString); |
|
|
Query query = queryParser.parse((String) whereJson.get("blurry")); |
|
|
booleanQueryBuilder.add(query, BooleanClause.Occur.MUST); |
|
|
booleanQueryBuilder.add(query, BooleanClause.Occur.MUST); |
|
|
docs = searcher.search(booleanQueryBuilder.build(), end,sort); |
|
|
docs = searcher.search(booleanQueryBuilder.build(), end,sort); |
|
|
} |
|
|
} |
|
|