|
|
@@ -320,8 +320,21 @@ public class SearchServiceImpl implements SearchService, InnerSearchService {
|
|
|
String key = entry.getKey();
|
|
|
Object value = entry.getValue();
|
|
|
String field = ClassAndTableNameUtils.combineField(tableName, key);
|
|
|
- if (value != null) {
|
|
|
- booleanQuery.add(SearchUtils.regexpQuery(field, String.valueOf(value), false), Occur.MUST_NOT);
|
|
|
+ // 排除多个值
|
|
|
+ if (value instanceof MultiValue) {
|
|
|
+ MultiValue multiValue = (MultiValue) value;
|
|
|
+ List<Object> values = multiValue.getValues();
|
|
|
+ Occur occur = multiValue.isOr() ? Occur.SHOULD : Occur.MUST;
|
|
|
+ BooleanQuery booleanQuery2 = new BooleanQuery();
|
|
|
+ for (Object object : values) {
|
|
|
+ booleanQuery2.add(SearchUtils.regexpQuery(field, String.valueOf(object), false), occur);
|
|
|
+ }
|
|
|
+ booleanQuery.add(booleanQuery2, Occur.MUST_NOT);
|
|
|
+ } else {
|
|
|
+ if (value != null) {
|
|
|
+ booleanQuery.add(SearchUtils.regexpQuery(field, String.valueOf(value), false),
|
|
|
+ Occur.MUST_NOT);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|