owl-cli 7.23.0 → 7.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1035,6 +1035,20 @@ var @projectCodeService = (function (pigeon) {
1035
1035
  return filters;
1036
1036
  },
1037
1037
 
1038
+ // 构建通配查询(将 SQL 风格的 % 转为 ES 的 *)
1039
+ buildWildcardQuery:function(k, v){
1040
+ // v 预期包含 % 作为通配符标记,转换为 ES 的 *
1041
+ var value = ('' + v).replace(/%/g, '*');
1042
+ var field = k + ".keyword";
1043
+ var wildcard = {};
1044
+ wildcard[field] = {
1045
+ value: value,
1046
+ // 在 ES 7.10+ 支持不区分大小写
1047
+ case_insensitive: true
1048
+ };
1049
+ return { wildcard: wildcard };
1050
+ },
1051
+
1038
1052
  buildQuery:function(mfilters,searchArgs,keyword,isRecycleBin,meta_fields){
1039
1053
  if(!meta_fields){
1040
1054
  var meta = spec["#meta"];
@@ -1124,9 +1138,19 @@ var @projectCodeService = (function (pigeon) {
1124
1138
  if(v){
1125
1139
  term[k+".keyword"] = trim('' + v)
1126
1140
  if(isNotClause){
1127
- must_not.push({term:term});
1141
+ if(v.indexOf('%')>-1){
1142
+ must_not.push(f.buildWildcardQuery(k, v));
1143
+ }
1144
+ else{
1145
+ must_not.push({term:term});
1146
+ }
1128
1147
  }else{
1129
- filters.push({term:term});
1148
+ if(v.indexOf('%')>-1){
1149
+ filters.push(f.buildWildcardQuery(k, v));
1150
+ }
1151
+ else{
1152
+ filters.push({term:term});
1153
+ }
1130
1154
  }
1131
1155
 
1132
1156
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "owl-cli",
3
- "version": "7.23.0",
3
+ "version": "7.25.0",
4
4
  "main": "index.js",
5
5
  "preferGlobal": true,
6
6
  "bin": {