diff --git a/acs/nladmin-system/src/main/java/org/nl/modules/lucence/common/Searcher.java b/acs/nladmin-system/src/main/java/org/nl/modules/lucence/common/Searcher.java index 27d76e3..9e1348b 100644 --- a/acs/nladmin-system/src/main/java/org/nl/modules/lucence/common/Searcher.java +++ b/acs/nladmin-system/src/main/java/org/nl/modules/lucence/common/Searcher.java @@ -68,15 +68,21 @@ public class Searcher { } TermRangeQuery termRangeQuery = new TermRangeQuery("logTime", new BytesRef(startDate), new BytesRef(endDate), true, true); 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("device_code") != null) queryString += " +device_code:"+(String) whereJson.get("device_code"); - if (whereJson.get("device_code") == null && whereJson.get("blurry") == null) { +// if (whereJson.get("blurry") != null) queryString += "fieldContent:"+(String) whereJson.get("blurry"); + if (whereJson.get("blurry") != null) queryString = (String) whereJson.get("blurry"); +// 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","*")); booleanQueryBuilder.add(query, BooleanClause.Occur.MUST); docs = searcher.search(booleanQueryBuilder.build(), end,sort); }else { - Query query = queryParser.parse(queryString); + Query query = queryParser.parse((String) whereJson.get("blurry")); booleanQueryBuilder.add(query, BooleanClause.Occur.MUST); docs = searcher.search(booleanQueryBuilder.build(), end,sort); }