owl-cli 7.23.0 → 7.26.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.
@@ -755,7 +755,7 @@ var @projectCodeService = (function (pigeon) {
755
755
  data.owl_lastModifiedUserId = userId;
756
756
  data.owl_lastModifiedIp = ip;
757
757
  data.owl_lastModifiedUserAgent = ua;
758
- data.obj.owl_modifyTime = new Date().getTime();
758
+ data.owl_modifyTime = new Date().getTime();
759
759
 
760
760
  var key = pigeon.getRKey(data['owl_createTime'], 13)
761
761
  pigeon.deleteFromList(f.getAllListName(), key, id)
@@ -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"];
@@ -1085,14 +1099,7 @@ var @projectCodeService = (function (pigeon) {
1085
1099
 
1086
1100
  }
1087
1101
  else{
1088
- if(v.args && typeof(v.args)==='object'){
1089
- var shouldQueries = f.createQuery(v);
1090
- if(isNotClause){
1091
- must_not.push({bool:{should:shouldClauses}});
1092
- }else{
1093
- filters.push({bool:{should:shouldClauses}});
1094
- }
1095
- }
1102
+ //do noting,所以 or 语句不支持 单个对象,必须带一个 args 数组
1096
1103
  }
1097
1104
  }
1098
1105
  else if(typeof(v)=='object' && Array.isArray(v)){
@@ -1124,9 +1131,19 @@ var @projectCodeService = (function (pigeon) {
1124
1131
  if(v){
1125
1132
  term[k+".keyword"] = trim('' + v)
1126
1133
  if(isNotClause){
1127
- must_not.push({term:term});
1134
+ if(v.indexOf('%')>-1){
1135
+ must_not.push(f.buildWildcardQuery(k, v));
1136
+ }
1137
+ else{
1138
+ must_not.push({term:term});
1139
+ }
1128
1140
  }else{
1129
- filters.push({term:term});
1141
+ if(v.indexOf('%')>-1){
1142
+ filters.push(f.buildWildcardQuery(k, v));
1143
+ }
1144
+ else{
1145
+ filters.push({term:term});
1146
+ }
1130
1147
  }
1131
1148
 
1132
1149
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "owl-cli",
3
- "version": "7.23.0",
3
+ "version": "7.26.0",
4
4
  "main": "index.js",
5
5
  "preferGlobal": true,
6
6
  "bin": {