c2-mongoose 2.1.50 → 2.1.51
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.
|
@@ -15,7 +15,7 @@ declare abstract class SearchFlow {
|
|
|
15
15
|
buildPopulate(): any;
|
|
16
16
|
buildPath(target: string, nested?: string): any;
|
|
17
17
|
buildOrdenation(): any;
|
|
18
|
-
|
|
18
|
+
buildRegex(searchText: string): RegExp;
|
|
19
19
|
searchPageable(model: mongoose.Model<any>, pipeline: any): Promise<{
|
|
20
20
|
items: any;
|
|
21
21
|
paging: any;
|
package/dist/flow/SearchFlow.js
CHANGED
|
@@ -135,15 +135,14 @@ var SearchFlow = /** @class */ (function () {
|
|
|
135
135
|
this.sort = order;
|
|
136
136
|
return order;
|
|
137
137
|
};
|
|
138
|
-
SearchFlow.prototype.
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
.replace(
|
|
142
|
-
.replace(
|
|
143
|
-
.replace(
|
|
144
|
-
.replace(/[
|
|
145
|
-
|
|
146
|
-
.replace(/[ç|Ç|c|C]/g, '[c,C,ç,Ç]');
|
|
138
|
+
SearchFlow.prototype.buildRegex = function (searchText) {
|
|
139
|
+
var regexExpression = searchText
|
|
140
|
+
.replace(/^"/, '^').replace(/"$/, '$') //Replace aspas duplas para busca exata
|
|
141
|
+
.replace(/^%22/, '^').replace(/%22$/, '$') //Replace aspas duplas para busca exata
|
|
142
|
+
.replace(/%20/, ' ') //Replace espaço em branco para nao quebrar o proximo replace
|
|
143
|
+
.replace(/%/g, '.*?') //Replace % para o padrão regex (% é muito utilizado como o .*? e é mais simples para o usuario digitar)
|
|
144
|
+
.replace(/[ç|c|C|Ç]/g, '[c,ç]');
|
|
145
|
+
return new RegExp("".concat(regexExpression), 'i');
|
|
147
146
|
};
|
|
148
147
|
SearchFlow.prototype.searchPageable = function (model, pipeline) {
|
|
149
148
|
return __awaiter(this, void 0, void 0, function () {
|
package/package.json
CHANGED
package/src/flow/SearchFlow.ts
CHANGED
|
@@ -64,14 +64,14 @@ abstract class SearchFlow {
|
|
|
64
64
|
return order
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
.replace(/
|
|
70
|
-
.replace(
|
|
71
|
-
.replace(
|
|
72
|
-
.replace(
|
|
73
|
-
.replace(/[
|
|
74
|
-
|
|
67
|
+
buildRegex(searchText: string): RegExp {
|
|
68
|
+
let regexExpression = searchText
|
|
69
|
+
.replace(/^"/, '^').replace(/"$/, '$') //Replace aspas duplas para busca exata
|
|
70
|
+
.replace(/^%22/, '^').replace(/%22$/, '$') //Replace aspas duplas para busca exata
|
|
71
|
+
.replace(/%20/, ' ') //Replace espaço em branco para nao quebrar o proximo replace
|
|
72
|
+
.replace(/%/g, '.*?') //Replace % para o padrão regex (% é muito utilizado como o .*? e é mais simples para o usuario digitar)
|
|
73
|
+
.replace(/[ç|c|C|Ç]/g, '[c,ç]')
|
|
74
|
+
return new RegExp(`${regexExpression}`, 'i');
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
async searchPageable(model: mongoose.Model<any>, pipeline: any) {
|