@outliant/sunrise-utils 1.3.9 → 1.4.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.
- package/CHANGELOG.md +14 -0
- package/helpers/commonFilter.js +630 -0
- package/helpers/projectFilter/index.js +5 -2
- package/helpers/projectFilter/projectIdFilter.js +62 -0
- package/helpers/searchFilter.js +22 -35
- package/helpers/taskFilter/index.js +6 -3
- package/helpers/taskFilter/projectIdFilter.js +62 -0
- package/lib/taskPipeline.js +1 -0
- package/package.json +1 -1
- package/test/lib/projectPipeline.spec.js +39 -125
package/CHANGELOG.md
CHANGED
|
@@ -4,9 +4,23 @@ All notable changes to this project will be documented in this file. Dates are d
|
|
|
4
4
|
|
|
5
5
|
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
6
6
|
|
|
7
|
+
#### [1.4.0](https://github.com/outliant/sunrise-utils/compare/1.3.10...1.4.0)
|
|
8
|
+
|
|
9
|
+
- chore: refactor task/project pipeline common filters #86b4dg28t [`54a12a9`](https://github.com/outliant/sunrise-utils/commit/54a12a9e80ea402825bd64589efdf91b65c207a1)
|
|
10
|
+
|
|
11
|
+
#### [1.3.10](https://github.com/outliant/sunrise-utils/compare/1.3.9...1.3.10)
|
|
12
|
+
|
|
13
|
+
> 27 March 2025
|
|
14
|
+
|
|
15
|
+
- chore(release): 1.3.10 [`f5348f0`](https://github.com/outliant/sunrise-utils/commit/f5348f0115b50d232fb85fe4cd1f3201116da6a6)
|
|
16
|
+
- chore: task_age updates [`02ad141`](https://github.com/outliant/sunrise-utils/commit/02ad141886dc8ae4a16da3173a016402316fbae3)
|
|
17
|
+
|
|
7
18
|
#### [1.3.9](https://github.com/outliant/sunrise-utils/compare/1.3.8...1.3.9)
|
|
8
19
|
|
|
20
|
+
> 22 March 2025
|
|
21
|
+
|
|
9
22
|
- chore: updated project pipeline critical path filter [`65eab79`](https://github.com/outliant/sunrise-utils/commit/65eab7911843b69045eb5ce8e2ba43e18982c15c)
|
|
23
|
+
- chore(release): 1.3.9 [`b8b7218`](https://github.com/outliant/sunrise-utils/commit/b8b7218eb9a38200f3f6f47aaec6e3ec36ea5a0a)
|
|
10
24
|
|
|
11
25
|
#### [1.3.8](https://github.com/outliant/sunrise-utils/compare/1.3.7...1.3.8)
|
|
12
26
|
|
|
@@ -0,0 +1,630 @@
|
|
|
1
|
+
const moment = require('moment');
|
|
2
|
+
|
|
3
|
+
const splitString = require('./splitString');
|
|
4
|
+
const { isNoneOf } = require('./common');
|
|
5
|
+
|
|
6
|
+
module.exports = (filter) => {
|
|
7
|
+
if (!filter.type) return null;
|
|
8
|
+
|
|
9
|
+
switch (filter.condition) {
|
|
10
|
+
case 'contains_any':
|
|
11
|
+
return module.exports.containsAny(filter);
|
|
12
|
+
case 'contains_none':
|
|
13
|
+
return module.exports.containsNone(filter);
|
|
14
|
+
case 'contains_all':
|
|
15
|
+
return module.exports.containsAll(filter);
|
|
16
|
+
case 'is_any_of':
|
|
17
|
+
return module.exports.isAnyOf(filter);
|
|
18
|
+
case 'is_empty':
|
|
19
|
+
return module.exports.isEmpty(filter);
|
|
20
|
+
case 'is_any_of':
|
|
21
|
+
return module.exports.isAnyOf(filter);
|
|
22
|
+
case 'is_not_empty':
|
|
23
|
+
return module.exports.isNotEmpty(filter);
|
|
24
|
+
case 'is_equal':
|
|
25
|
+
if (filter.type === 'ready_at') {
|
|
26
|
+
return module.exports.isReadyAt(filter);
|
|
27
|
+
}
|
|
28
|
+
return module.exports.isEqual(filter);
|
|
29
|
+
case 'not_equal':
|
|
30
|
+
return module.exports.isNotEqual(filter);
|
|
31
|
+
case 'is_none_of':
|
|
32
|
+
return isNoneOf(filter, module.exports.isEqual);
|
|
33
|
+
case 'before':
|
|
34
|
+
case 'less_than':
|
|
35
|
+
return module.exports.isBefore(filter);
|
|
36
|
+
case 'after':
|
|
37
|
+
case 'greater_than':
|
|
38
|
+
return module.exports.isAfter(filter);
|
|
39
|
+
case 'less_than_or_equal':
|
|
40
|
+
return module.exports.isBeforeIncludeParam(filter);
|
|
41
|
+
case 'greater_than_or_equal':
|
|
42
|
+
return module.exports.isAfterIncludeParam(filter);
|
|
43
|
+
case 'between':
|
|
44
|
+
return module.exports.isBetween(filter);
|
|
45
|
+
case 'next_n_days':
|
|
46
|
+
return module.exports.nextNDays(filter);
|
|
47
|
+
case 'last_n_days':
|
|
48
|
+
return module.exports.lastNDays(filter);
|
|
49
|
+
case 'greater_n_days_ago':
|
|
50
|
+
return module.exports.greaterNDaysAgo(filter);
|
|
51
|
+
case 'is_true':
|
|
52
|
+
return module.exports.isTrue(filter);
|
|
53
|
+
case 'is_false':
|
|
54
|
+
return module.exports.isFalse(filter);
|
|
55
|
+
default:
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
module.exports.containsAny = (filter) => {
|
|
61
|
+
const type = filter.field_type || filter.type;
|
|
62
|
+
|
|
63
|
+
if (['text', 'textarea'].includes(type)) {
|
|
64
|
+
return {
|
|
65
|
+
match: {
|
|
66
|
+
[filter.type]: {
|
|
67
|
+
query: filter.value,
|
|
68
|
+
fuzziness: 'AUTO'
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
} else if (['checkbox', 'select'].includes(type)) {
|
|
73
|
+
const value =
|
|
74
|
+
typeof filter.value === 'string'
|
|
75
|
+
? splitString(filter.value)
|
|
76
|
+
: filter.value;
|
|
77
|
+
|
|
78
|
+
return {
|
|
79
|
+
terms: {
|
|
80
|
+
[filter.type]: value
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return null;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
module.exports.containsAll = (filter) => {
|
|
89
|
+
const type = filter.field_type || filter.type;
|
|
90
|
+
|
|
91
|
+
if (['text', 'textarea'].includes(type)) {
|
|
92
|
+
return {
|
|
93
|
+
match: {
|
|
94
|
+
[filter.type]: {
|
|
95
|
+
query: filter.value,
|
|
96
|
+
fuzziness: 'AUTO'
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
} else if (['checkbox', 'select'].includes(type)) {
|
|
101
|
+
const value =
|
|
102
|
+
typeof filter.value === 'string'
|
|
103
|
+
? splitString(filter.value)
|
|
104
|
+
: filter.value;
|
|
105
|
+
|
|
106
|
+
return {
|
|
107
|
+
bool: {
|
|
108
|
+
must: value.map((val) => ({
|
|
109
|
+
term: {
|
|
110
|
+
[filter.type]: {
|
|
111
|
+
value: val
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}))
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
return null;
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
module.exports.containsNone = (filter) => {
|
|
123
|
+
const type = filter.field_type || filter.type;
|
|
124
|
+
|
|
125
|
+
if (['text', 'textarea'].includes(type)) {
|
|
126
|
+
return {
|
|
127
|
+
bool: {
|
|
128
|
+
must_not: [
|
|
129
|
+
{
|
|
130
|
+
match: {
|
|
131
|
+
[filter.type]: {
|
|
132
|
+
query: filter.value,
|
|
133
|
+
fuzziness: 'AUTO'
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
]
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
} else if (['checkbox', 'select'].includes(type)) {
|
|
141
|
+
const value =
|
|
142
|
+
typeof filter.value === 'string'
|
|
143
|
+
? splitString(filter.value)
|
|
144
|
+
: filter.value;
|
|
145
|
+
|
|
146
|
+
return {
|
|
147
|
+
bool: {
|
|
148
|
+
must_not: [
|
|
149
|
+
{
|
|
150
|
+
terms: {
|
|
151
|
+
[filter.type]: value
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
]
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
return null;
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
module.exports.isAnyOf = (filter) => {
|
|
163
|
+
const type = filter.field_type || filter.type;
|
|
164
|
+
|
|
165
|
+
if (['text', 'textarea'].includes(type)) {
|
|
166
|
+
return {
|
|
167
|
+
match: {
|
|
168
|
+
[filter.type]: {
|
|
169
|
+
query: filter.value,
|
|
170
|
+
fuzziness: 'AUTO'
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
} else {
|
|
175
|
+
const value =
|
|
176
|
+
typeof filter.value === 'string'
|
|
177
|
+
? splitString(filter.value)
|
|
178
|
+
: filter.value;
|
|
179
|
+
|
|
180
|
+
return {
|
|
181
|
+
terms: {
|
|
182
|
+
[filter.type]: value
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
module.exports.isEmpty = (filter) => {
|
|
189
|
+
if (filter.field_type === 'text' || filter.field_type === 'textarea') {
|
|
190
|
+
return {
|
|
191
|
+
bool: {
|
|
192
|
+
should: [
|
|
193
|
+
{
|
|
194
|
+
bool: {
|
|
195
|
+
must_not: [
|
|
196
|
+
{
|
|
197
|
+
exists: {
|
|
198
|
+
field: filter.type
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
]
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
bool: {
|
|
206
|
+
must_not: [
|
|
207
|
+
{
|
|
208
|
+
wildcard: {
|
|
209
|
+
[filter.type]: {
|
|
210
|
+
value: '?*'
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
]
|
|
215
|
+
}
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
term: {
|
|
219
|
+
[filter.type]: {
|
|
220
|
+
value: ''
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
]
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
return {
|
|
229
|
+
bool: {
|
|
230
|
+
should: [
|
|
231
|
+
{
|
|
232
|
+
term: {
|
|
233
|
+
[filter.type]: {
|
|
234
|
+
value: ''
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
bool: {
|
|
240
|
+
must_not: [
|
|
241
|
+
{
|
|
242
|
+
exists: {
|
|
243
|
+
field: filter.type
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
]
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
]
|
|
250
|
+
}
|
|
251
|
+
};
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
module.exports.isNotEmpty = (filter) => {
|
|
255
|
+
if (filter.field_type === 'text' || filter.field_type === 'textarea') {
|
|
256
|
+
return {
|
|
257
|
+
bool: {
|
|
258
|
+
must: [
|
|
259
|
+
{
|
|
260
|
+
exists: {
|
|
261
|
+
field: filter.type
|
|
262
|
+
}
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
wildcard: {
|
|
266
|
+
[filter.type]: {
|
|
267
|
+
value: '?*'
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
bool: {
|
|
273
|
+
must_not: [
|
|
274
|
+
{
|
|
275
|
+
term: {
|
|
276
|
+
[filter.type]: {
|
|
277
|
+
value: ''
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
]
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
]
|
|
285
|
+
}
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
return {
|
|
290
|
+
bool: {
|
|
291
|
+
must_not: [
|
|
292
|
+
{
|
|
293
|
+
term: {
|
|
294
|
+
[filter.type]: {
|
|
295
|
+
value: ''
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
],
|
|
300
|
+
must: [
|
|
301
|
+
{
|
|
302
|
+
exists: {
|
|
303
|
+
field: filter.type
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
]
|
|
307
|
+
}
|
|
308
|
+
};
|
|
309
|
+
};
|
|
310
|
+
|
|
311
|
+
module.exports.isEqual = (filter) => {
|
|
312
|
+
if (filter.field_type === 'date') {
|
|
313
|
+
const startOfDay = moment(filter.value).startOf('day').valueOf();
|
|
314
|
+
const endOfDay = moment(filter.value).endOf('day').valueOf();
|
|
315
|
+
|
|
316
|
+
return {
|
|
317
|
+
range: {
|
|
318
|
+
[filter.type]: {
|
|
319
|
+
gte: startOfDay,
|
|
320
|
+
lte: endOfDay
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
if (filter.field_type === 'textarea') {
|
|
327
|
+
return {
|
|
328
|
+
query_string: {
|
|
329
|
+
fields: [filter.type],
|
|
330
|
+
query: `*${filter.value}*`
|
|
331
|
+
}
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
if (filter.field_type === 'checkbox') {
|
|
336
|
+
const value =
|
|
337
|
+
typeof filter.value === 'string'
|
|
338
|
+
? splitString(filter.value)
|
|
339
|
+
: filter.value;
|
|
340
|
+
|
|
341
|
+
const should = [];
|
|
342
|
+
|
|
343
|
+
value.forEach((x) => {
|
|
344
|
+
should.push({
|
|
345
|
+
match: {
|
|
346
|
+
[`${filter.type}.analyzed`]: {
|
|
347
|
+
query: x,
|
|
348
|
+
operator: 'and'
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
});
|
|
352
|
+
|
|
353
|
+
should.push({
|
|
354
|
+
term: {
|
|
355
|
+
[filter.type]: {
|
|
356
|
+
value: x
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
});
|
|
360
|
+
});
|
|
361
|
+
|
|
362
|
+
return {
|
|
363
|
+
bool: {
|
|
364
|
+
should
|
|
365
|
+
}
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
if (filter.field_type === 'number') {
|
|
370
|
+
return {
|
|
371
|
+
term: {
|
|
372
|
+
[filter.type]: {
|
|
373
|
+
value: parseInt(filter.value)
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
return {
|
|
380
|
+
term: {
|
|
381
|
+
[filter.type]: {
|
|
382
|
+
value: filter.value
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
};
|
|
386
|
+
};
|
|
387
|
+
|
|
388
|
+
module.exports.isReadyAt = (filter) => {
|
|
389
|
+
const startOfDay = moment(filter.value).startOf('day').valueOf();
|
|
390
|
+
const endOfDay = moment(filter.value).endOf('day').valueOf();
|
|
391
|
+
|
|
392
|
+
return {
|
|
393
|
+
script: {
|
|
394
|
+
script: {
|
|
395
|
+
source: `
|
|
396
|
+
try {
|
|
397
|
+
def filterType = params.filterType;
|
|
398
|
+
def taskFilter = doc[filterType];
|
|
399
|
+
|
|
400
|
+
if (taskFilter.size() == 0) {
|
|
401
|
+
return false;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
long startOfDay = params.startOfDay;
|
|
405
|
+
long endOfDay = params.endOfDay;
|
|
406
|
+
|
|
407
|
+
if (
|
|
408
|
+
filterType == 'ready_at' &&
|
|
409
|
+
doc['is_complete'].size() != 0 &&
|
|
410
|
+
doc['is_complete'].value == true &&
|
|
411
|
+
doc['completed_at'].size() != 0
|
|
412
|
+
) {
|
|
413
|
+
long completedAt = doc['completed_at'].value.millis;
|
|
414
|
+
return completedAt >= startOfDay && completedAt <= endOfDay;
|
|
415
|
+
} else {
|
|
416
|
+
long taskFilterValue = taskFilter.value.millis;
|
|
417
|
+
return taskFilterValue >= startOfDay && taskFilterValue <= endOfDay;
|
|
418
|
+
}
|
|
419
|
+
} catch(Exception err){
|
|
420
|
+
return false;
|
|
421
|
+
}`,
|
|
422
|
+
lang: 'painless',
|
|
423
|
+
params: {
|
|
424
|
+
startOfDay,
|
|
425
|
+
endOfDay,
|
|
426
|
+
filterType: filter.type
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
};
|
|
431
|
+
};
|
|
432
|
+
|
|
433
|
+
module.exports.isBefore = (filter) => {
|
|
434
|
+
let param;
|
|
435
|
+
|
|
436
|
+
if (filter.field_type === 'date') {
|
|
437
|
+
param = moment(filter.value).startOf('day').valueOf();
|
|
438
|
+
} else if (filter.field_type === 'number') {
|
|
439
|
+
param = parseInt(filter.value);
|
|
440
|
+
} else {
|
|
441
|
+
return null;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
return {
|
|
445
|
+
range: {
|
|
446
|
+
[filter.type]: {
|
|
447
|
+
lt: param
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
};
|
|
451
|
+
};
|
|
452
|
+
|
|
453
|
+
module.exports.isAfter = (filter) => {
|
|
454
|
+
let param;
|
|
455
|
+
|
|
456
|
+
if (filter.field_type === 'date') {
|
|
457
|
+
param = moment(filter.value).endOf('day').valueOf();
|
|
458
|
+
} else if (filter.field_type === 'number') {
|
|
459
|
+
param = parseInt(filter.value);
|
|
460
|
+
} else {
|
|
461
|
+
return null;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
return {
|
|
465
|
+
range: {
|
|
466
|
+
[filter.type]: {
|
|
467
|
+
gt: param
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
};
|
|
471
|
+
};
|
|
472
|
+
|
|
473
|
+
module.exports.nextNDays = (filter) => {
|
|
474
|
+
if (isNaN(filter.value)) {
|
|
475
|
+
return null;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
return {
|
|
479
|
+
range: {
|
|
480
|
+
[filter.type]: {
|
|
481
|
+
lt: `now/d+${filter.value}d`,
|
|
482
|
+
gt: 'now/d'
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
};
|
|
486
|
+
};
|
|
487
|
+
|
|
488
|
+
module.exports.lastNDays = (filter) => {
|
|
489
|
+
if (isNaN(filter.value)) {
|
|
490
|
+
return null;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
return {
|
|
494
|
+
range: {
|
|
495
|
+
[filter.type]: {
|
|
496
|
+
gt: `now/d-${filter.value}d`,
|
|
497
|
+
lt: 'now/d'
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
};
|
|
501
|
+
};
|
|
502
|
+
|
|
503
|
+
module.exports.greaterNDaysAgo = (filter) => {
|
|
504
|
+
if (isNaN(filter.value)) {
|
|
505
|
+
return null;
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
return {
|
|
509
|
+
range: {
|
|
510
|
+
[filter.type]: {
|
|
511
|
+
lt: `now/d-${filter.value}d`
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
};
|
|
515
|
+
};
|
|
516
|
+
|
|
517
|
+
module.exports.isBeforeIncludeParam = (filter) => {
|
|
518
|
+
let param;
|
|
519
|
+
|
|
520
|
+
if (filter.field_type === 'date') {
|
|
521
|
+
param = moment(filter.value).endOf('day').valueOf();
|
|
522
|
+
} else if (filter.field_type === 'number') {
|
|
523
|
+
param = parseInt(filter.value);
|
|
524
|
+
} else {
|
|
525
|
+
return null;
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
return {
|
|
529
|
+
range: {
|
|
530
|
+
[filter.type]: {
|
|
531
|
+
lte: param
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
};
|
|
535
|
+
};
|
|
536
|
+
|
|
537
|
+
module.exports.isAfterIncludeParam = (filter) => {
|
|
538
|
+
let param;
|
|
539
|
+
|
|
540
|
+
if (filter.field_type === 'date') {
|
|
541
|
+
param = moment(filter.value).endOf('day').valueOf();
|
|
542
|
+
} else if (filter.field_type === 'number') {
|
|
543
|
+
param = parseInt(filter.value);
|
|
544
|
+
} else {
|
|
545
|
+
return null;
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
return {
|
|
549
|
+
range: {
|
|
550
|
+
[filter.type]: {
|
|
551
|
+
gte: param
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
};
|
|
555
|
+
};
|
|
556
|
+
|
|
557
|
+
module.exports.isBetween = (filter) => {
|
|
558
|
+
let firstParam;
|
|
559
|
+
let secondParam;
|
|
560
|
+
|
|
561
|
+
if (filter.field_type === 'date') {
|
|
562
|
+
firstParam = moment(filter.value).startOf('day').valueOf();
|
|
563
|
+
secondParam = moment(filter.second_value).endOf('day').valueOf();
|
|
564
|
+
} else if (filter.field_type === 'number') {
|
|
565
|
+
firstParam = parseInt(filter.value);
|
|
566
|
+
secondParam = parseInt(filter.second_value);
|
|
567
|
+
} else {
|
|
568
|
+
return null;
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
return {
|
|
572
|
+
range: {
|
|
573
|
+
[filter.type]: {
|
|
574
|
+
gte: firstParam,
|
|
575
|
+
lte: secondParam
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
};
|
|
579
|
+
};
|
|
580
|
+
|
|
581
|
+
module.exports.isNotEqual = (filter) => {
|
|
582
|
+
const equalFilter = module.exports.isEqual(filter);
|
|
583
|
+
|
|
584
|
+
if (equalFilter) {
|
|
585
|
+
return {
|
|
586
|
+
bool: {
|
|
587
|
+
must_not: equalFilter
|
|
588
|
+
}
|
|
589
|
+
};
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
return null;
|
|
593
|
+
};
|
|
594
|
+
|
|
595
|
+
module.exports.isTrue = (filter) => {
|
|
596
|
+
if (filter.field_type !== 'boolean') return null;
|
|
597
|
+
|
|
598
|
+
return {
|
|
599
|
+
term: {
|
|
600
|
+
[filter.type]: {
|
|
601
|
+
value: true
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
};
|
|
605
|
+
};
|
|
606
|
+
|
|
607
|
+
module.exports.isFalse = (filter) => {
|
|
608
|
+
if (filter.field_type !== 'boolean') return null;
|
|
609
|
+
|
|
610
|
+
return {
|
|
611
|
+
bool: {
|
|
612
|
+
should: [
|
|
613
|
+
{
|
|
614
|
+
match: {
|
|
615
|
+
[filter.type]: false
|
|
616
|
+
}
|
|
617
|
+
},
|
|
618
|
+
{
|
|
619
|
+
bool: {
|
|
620
|
+
must_not: {
|
|
621
|
+
exists: {
|
|
622
|
+
field: filter.type
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
]
|
|
628
|
+
}
|
|
629
|
+
};
|
|
630
|
+
};
|
|
@@ -4,9 +4,10 @@ const buildCriticalPathAgeFilter = require('./criticalPathAgeFilter');
|
|
|
4
4
|
const buildOnHoldFilter = require('./onHoldFilter');
|
|
5
5
|
const buildIsPausedFilter = require('./isPausedFilter');
|
|
6
6
|
const buildIsGeneratedFilter = require('./isGeneratedFilter');
|
|
7
|
+
const buildProjectIdFilter = require('./projectIdFilter');
|
|
7
8
|
const buildTagFilter = require('./tagFilter');
|
|
8
9
|
const buildProjectFieldFilter = require('./projectFieldFilter');
|
|
9
|
-
const
|
|
10
|
+
const buildCommonFilter = require('../commonFilter');
|
|
10
11
|
const { PROJECT_BANNERS } = require('../../constants');
|
|
11
12
|
|
|
12
13
|
module.exports.defaultCustomColumns = [
|
|
@@ -143,6 +144,8 @@ module.exports.defaultFilterSetting = {
|
|
|
143
144
|
|
|
144
145
|
module.exports.buildProjectPipelineFilter = (filter) => {
|
|
145
146
|
switch (filter.type) {
|
|
147
|
+
case 'project_id':
|
|
148
|
+
return buildProjectIdFilter(filter);
|
|
146
149
|
case 'tags':
|
|
147
150
|
return buildTagFilter(filter);
|
|
148
151
|
case 'region':
|
|
@@ -162,6 +165,6 @@ module.exports.buildProjectPipelineFilter = (filter) => {
|
|
|
162
165
|
case 'contactPropertyMappings':
|
|
163
166
|
return buildProjectFieldFilter(filter);
|
|
164
167
|
default:
|
|
165
|
-
return
|
|
168
|
+
return buildCommonFilter(filter);
|
|
166
169
|
}
|
|
167
170
|
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
module.exports = (filter) => {
|
|
2
|
+
switch (filter.condition) {
|
|
3
|
+
case 'is_equal':
|
|
4
|
+
return module.exports.isEqual(filter);
|
|
5
|
+
case 'not_equal':
|
|
6
|
+
return module.exports.isNotEqual(filter);
|
|
7
|
+
case 'is_any_of':
|
|
8
|
+
return module.exports.isEqual(filter);
|
|
9
|
+
case 'is_none_of':
|
|
10
|
+
return module.exports.isNotEqual(filter);
|
|
11
|
+
case 'contains_any':
|
|
12
|
+
return module.exports.containsAny(filter);
|
|
13
|
+
case 'contains_none':
|
|
14
|
+
return module.exports.containsNone(filter);
|
|
15
|
+
default:
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
module.exports.isEqual = (filter) => {
|
|
21
|
+
return {
|
|
22
|
+
match: {
|
|
23
|
+
_id: filter.value
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
module.exports.isNotEqual = (filter) => {
|
|
29
|
+
return {
|
|
30
|
+
bool: {
|
|
31
|
+
must_not: {
|
|
32
|
+
match: {
|
|
33
|
+
_id: filter.value
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
module.exports.containsAny = (filter) => {
|
|
41
|
+
return {
|
|
42
|
+
wildcard: {
|
|
43
|
+
id: {
|
|
44
|
+
value: `*${(filter.value || '').toUpperCase()}*`
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
module.exports.containsNone = (filter) => {
|
|
51
|
+
return {
|
|
52
|
+
bool: {
|
|
53
|
+
must_not: {
|
|
54
|
+
wildcard: {
|
|
55
|
+
id: {
|
|
56
|
+
value: `*${(filter.value || '').toUpperCase()}*`
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
};
|
package/helpers/searchFilter.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
const { validate: isUuid } = require('uuid');
|
|
2
2
|
const { escapeElasticQuery } = require('./es');
|
|
3
|
-
const _ = require('lodash');
|
|
4
3
|
|
|
5
|
-
module.exports = (query = {}, searchFields = []
|
|
4
|
+
module.exports = (query = {}, searchFields = []) => {
|
|
6
5
|
const search = query.search;
|
|
7
6
|
let searchString = search.trim();
|
|
8
7
|
|
|
@@ -19,42 +18,30 @@ module.exports = (query = {}, searchFields = [], isGlobalSearch = false) => {
|
|
|
19
18
|
const localFields = searchFields.filter((x) => x !== '_id' && !isUuid(x));
|
|
20
19
|
|
|
21
20
|
if (searchFields.includes('_id')) {
|
|
22
|
-
should.push(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
_.split(_.replace(searchString, /ser-|com-/gi, ''), ' ').filter(Boolean),
|
|
28
|
-
term => [
|
|
29
|
-
{ term: { _id: `SER-${term}` } },
|
|
30
|
-
{ term: { _id: `COM-${term}` } },
|
|
31
|
-
{ term: { _id: term } }
|
|
32
|
-
]
|
|
33
|
-
)
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
: {
|
|
37
|
-
term: {
|
|
38
|
-
_id: {
|
|
39
|
-
value: searchString
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
);
|
|
21
|
+
should.push({
|
|
22
|
+
match: {
|
|
23
|
+
_id: searchString
|
|
24
|
+
}
|
|
25
|
+
});
|
|
44
26
|
}
|
|
45
27
|
|
|
46
|
-
if (
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
should.push({
|
|
52
|
-
wildcard: {
|
|
53
|
-
id: {
|
|
54
|
-
value: `*${keyword}*`
|
|
55
|
-
}
|
|
28
|
+
if (searchFields.includes('id')) {
|
|
29
|
+
should.push({
|
|
30
|
+
wildcard: {
|
|
31
|
+
id: {
|
|
32
|
+
value: `*${searchString.toUpperCase()}*`
|
|
56
33
|
}
|
|
57
|
-
}
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (searchFields.includes('project_id')) {
|
|
39
|
+
should.push({
|
|
40
|
+
wildcard: {
|
|
41
|
+
project_id: {
|
|
42
|
+
value: `*${searchString.toUpperCase()}*`
|
|
43
|
+
}
|
|
44
|
+
}
|
|
58
45
|
});
|
|
59
46
|
}
|
|
60
47
|
|
|
@@ -3,6 +3,7 @@ const buildOwnerFilter = require('./ownerFilter');
|
|
|
3
3
|
const buildPathAgeFilter = require('./pathAgeFilter');
|
|
4
4
|
const buildRegionFilter = require('./regionFilter');
|
|
5
5
|
const buildTaskFieldFilter = require('./taskFieldFilter');
|
|
6
|
+
const buildProjectIdFilter = require('./projectIdFilter');
|
|
6
7
|
const buildCriticalPathFilter = require('./criticalPathFilter');
|
|
7
8
|
const buildOnHoldFilter = require('./onHoldFilter');
|
|
8
9
|
const buildIsPausedFilter = require('./isPausedFilter');
|
|
@@ -11,6 +12,7 @@ const buildDaysToCompleteFilter = require('./daysToComplete');
|
|
|
11
12
|
const buildAgeColorFilter = require('./buildAgeColorFilter');
|
|
12
13
|
const buildWasMarkedIncompleteFilter = require('./wasMarkedIncomplete');
|
|
13
14
|
const buildProjectFieldFilter = require('../projectFilter/projectFieldFilter');
|
|
15
|
+
const buildCommonFilter = require('../commonFilter');
|
|
14
16
|
const { PROJECT_BANNERS } = require('../../constants');
|
|
15
17
|
const splitString = require('../splitString');
|
|
16
18
|
|
|
@@ -274,7 +276,7 @@ module.exports.defaultCustomColumns = [
|
|
|
274
276
|
type: 'task_age',
|
|
275
277
|
field_type: 'select',
|
|
276
278
|
options: module.exports.taskAgeColorOptions,
|
|
277
|
-
select_fields: []
|
|
279
|
+
select_fields: ['ready_at']
|
|
278
280
|
}
|
|
279
281
|
];
|
|
280
282
|
|
|
@@ -327,6 +329,8 @@ module.exports.defaultFilterSetting = {
|
|
|
327
329
|
|
|
328
330
|
module.exports.buildTaskPipelineFilter = (filter, starredTaskIds) => {
|
|
329
331
|
switch (filter.type) {
|
|
332
|
+
case 'project_id':
|
|
333
|
+
return buildProjectIdFilter(filter);
|
|
330
334
|
case 'status':
|
|
331
335
|
return buildStatusFilter(filter);
|
|
332
336
|
case 'owner':
|
|
@@ -390,7 +394,6 @@ module.exports.buildTaskPipelineFilter = (filter, starredTaskIds) => {
|
|
|
390
394
|
case 'is_starred':
|
|
391
395
|
return buildIsStarredFilter(filter, starredTaskIds);
|
|
392
396
|
default:
|
|
393
|
-
|
|
394
|
-
return buildTaskFieldFilter(filter);
|
|
397
|
+
return buildCommonFilter(filter);
|
|
395
398
|
}
|
|
396
399
|
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
module.exports = (filter) => {
|
|
2
|
+
switch (filter.condition) {
|
|
3
|
+
case 'is_equal':
|
|
4
|
+
return module.exports.isEqual(filter);
|
|
5
|
+
case 'not_equal':
|
|
6
|
+
return module.exports.isNotEqual(filter);
|
|
7
|
+
case 'is_any_of':
|
|
8
|
+
return module.exports.isEqual(filter);
|
|
9
|
+
case 'is_none_of':
|
|
10
|
+
return module.exports.isNotEqual(filter);
|
|
11
|
+
case 'contains_any':
|
|
12
|
+
return module.exports.containsAny(filter);
|
|
13
|
+
case 'contains_none':
|
|
14
|
+
return module.exports.containsNone(filter);
|
|
15
|
+
default:
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
module.exports.isEqual = (filter) => {
|
|
21
|
+
return {
|
|
22
|
+
match: {
|
|
23
|
+
project_id: filter.value
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
module.exports.isNotEqual = (filter) => {
|
|
29
|
+
return {
|
|
30
|
+
bool: {
|
|
31
|
+
must_not: {
|
|
32
|
+
match: {
|
|
33
|
+
project_id: filter.value
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
module.exports.containsAny = (filter) => {
|
|
41
|
+
return {
|
|
42
|
+
wildcard: {
|
|
43
|
+
project_id: {
|
|
44
|
+
value: `*${(filter.value || '').toUpperCase()}*`
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
module.exports.containsNone = (filter) => {
|
|
51
|
+
return {
|
|
52
|
+
bool: {
|
|
53
|
+
must_not: {
|
|
54
|
+
wildcard: {
|
|
55
|
+
project_id: {
|
|
56
|
+
value: `*${(filter.value || '').toUpperCase()}*`
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
};
|
package/lib/taskPipeline.js
CHANGED
package/package.json
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
/* eslint-env node, mocha */
|
|
4
4
|
const { expect } = require('chai');
|
|
5
|
-
const _ = require('lodash');
|
|
6
5
|
|
|
7
6
|
const projectPipeline = require('../../lib/projectPipeline');
|
|
8
7
|
|
|
@@ -17,48 +16,19 @@ describe('projectPipeline', function () {
|
|
|
17
16
|
expected: {
|
|
18
17
|
bool: {
|
|
19
18
|
must: [
|
|
20
|
-
{
|
|
21
|
-
|
|
22
|
-
organization_id: {
|
|
23
|
-
value: ORG_ID
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
term: {
|
|
29
|
-
department_id: {
|
|
30
|
-
value: DEPARTMENT_ID
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
},
|
|
19
|
+
{ term: { organization_id: { value: 'orgId' } } },
|
|
20
|
+
{ term: { department_id: { value: 'department_id' } } },
|
|
34
21
|
{
|
|
35
22
|
bool: {
|
|
36
23
|
should: [
|
|
37
|
-
{
|
|
38
|
-
wildcard: {
|
|
39
|
-
id: {
|
|
40
|
-
value: '*COM*'
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
wildcard: {
|
|
46
|
-
id: {
|
|
47
|
-
value: '*41853*'
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
},
|
|
24
|
+
{ wildcard: { project_id: { value: '*COM-41853*' } } },
|
|
51
25
|
{
|
|
52
26
|
multi_match: {
|
|
53
27
|
query: 'COM-41853',
|
|
54
28
|
fields: ['project_id^5']
|
|
55
29
|
}
|
|
56
30
|
},
|
|
57
|
-
{
|
|
58
|
-
match_phrase_prefix: {
|
|
59
|
-
name: 'COM-41853'
|
|
60
|
-
}
|
|
61
|
-
}
|
|
31
|
+
{ match_phrase_prefix: { name: 'COM-41853' } }
|
|
62
32
|
]
|
|
63
33
|
}
|
|
64
34
|
}
|
|
@@ -71,48 +41,19 @@ describe('projectPipeline', function () {
|
|
|
71
41
|
expected: {
|
|
72
42
|
bool: {
|
|
73
43
|
must: [
|
|
74
|
-
{
|
|
75
|
-
|
|
76
|
-
organization_id: {
|
|
77
|
-
value: ORG_ID
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
term: {
|
|
83
|
-
department_id: {
|
|
84
|
-
value: DEPARTMENT_ID
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
},
|
|
44
|
+
{ term: { organization_id: { value: 'orgId' } } },
|
|
45
|
+
{ term: { department_id: { value: 'department_id' } } },
|
|
88
46
|
{
|
|
89
47
|
bool: {
|
|
90
48
|
should: [
|
|
91
|
-
{
|
|
92
|
-
wildcard: {
|
|
93
|
-
id: {
|
|
94
|
-
value: '*com*'
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
},
|
|
98
|
-
{
|
|
99
|
-
wildcard: {
|
|
100
|
-
id: {
|
|
101
|
-
value: '*41853*'
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
},
|
|
49
|
+
{ wildcard: { project_id: { value: '*COM-41853*' } } },
|
|
105
50
|
{
|
|
106
51
|
multi_match: {
|
|
107
52
|
query: 'com-41853',
|
|
108
53
|
fields: ['project_id^5']
|
|
109
54
|
}
|
|
110
55
|
},
|
|
111
|
-
{
|
|
112
|
-
match_phrase_prefix: {
|
|
113
|
-
name: 'com-41853'
|
|
114
|
-
}
|
|
115
|
-
}
|
|
56
|
+
{ match_phrase_prefix: { name: 'com-41853' } }
|
|
116
57
|
]
|
|
117
58
|
}
|
|
118
59
|
}
|
|
@@ -125,41 +66,16 @@ describe('projectPipeline', function () {
|
|
|
125
66
|
expected: {
|
|
126
67
|
bool: {
|
|
127
68
|
must: [
|
|
128
|
-
{
|
|
129
|
-
|
|
130
|
-
organization_id: {
|
|
131
|
-
value: ORG_ID
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
term: {
|
|
137
|
-
department_id: {
|
|
138
|
-
value: DEPARTMENT_ID
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
},
|
|
69
|
+
{ term: { organization_id: { value: 'orgId' } } },
|
|
70
|
+
{ term: { department_id: { value: 'department_id' } } },
|
|
142
71
|
{
|
|
143
72
|
bool: {
|
|
144
73
|
should: [
|
|
74
|
+
{ wildcard: { project_id: { value: '*41853*' } } },
|
|
145
75
|
{
|
|
146
|
-
|
|
147
|
-
id: {
|
|
148
|
-
value: '*41853*'
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
},
|
|
152
|
-
{
|
|
153
|
-
multi_match: {
|
|
154
|
-
query: '41853',
|
|
155
|
-
fields: ['project_id^5']
|
|
156
|
-
}
|
|
76
|
+
multi_match: { query: '41853', fields: ['project_id^5'] }
|
|
157
77
|
},
|
|
158
|
-
{
|
|
159
|
-
match_phrase_prefix: {
|
|
160
|
-
name: '41853'
|
|
161
|
-
}
|
|
162
|
-
}
|
|
78
|
+
{ match_phrase_prefix: { name: '41853' } }
|
|
163
79
|
]
|
|
164
80
|
}
|
|
165
81
|
}
|
|
@@ -180,7 +96,7 @@ describe('projectPipeline', function () {
|
|
|
180
96
|
DEPARTMENT_ID,
|
|
181
97
|
[],
|
|
182
98
|
query,
|
|
183
|
-
['project_id']
|
|
99
|
+
['project_id']
|
|
184
100
|
);
|
|
185
101
|
|
|
186
102
|
expect(result).to.deep.equal(entry.expected);
|
|
@@ -295,44 +211,33 @@ describe('projectPipeline', function () {
|
|
|
295
211
|
params.projectSearchFields,
|
|
296
212
|
true
|
|
297
213
|
);
|
|
298
|
-
|
|
299
214
|
expect(result).to.be.deep.equal({
|
|
300
215
|
bool: {
|
|
301
216
|
must: [
|
|
302
|
-
{
|
|
303
|
-
|
|
304
|
-
organization_id: { value: 'orgId' }
|
|
305
|
-
}
|
|
306
|
-
},
|
|
307
|
-
{
|
|
308
|
-
term: {
|
|
309
|
-
department_id: { value: 'department_id' }
|
|
310
|
-
}
|
|
311
|
-
},
|
|
217
|
+
{ term: { organization_id: { value: 'orgId' } } },
|
|
218
|
+
{ term: { department_id: { value: 'department_id' } } },
|
|
312
219
|
{
|
|
313
220
|
bool: {
|
|
314
221
|
should: [
|
|
315
222
|
{
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
]
|
|
324
|
-
)
|
|
223
|
+
match: { _id: '41853 69 SER-69 allan DoNALD Vikram RalPH' }
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
wildcard: {
|
|
227
|
+
id: {
|
|
228
|
+
value: '*41853 69 SER-69 ALLAN DONALD VIKRAM RALPH*'
|
|
229
|
+
}
|
|
325
230
|
}
|
|
326
231
|
},
|
|
327
232
|
{
|
|
328
233
|
multi_match: {
|
|
329
|
-
query:
|
|
234
|
+
query: '41853 69 SER-69 allan DoNALD Vikram RalPH',
|
|
330
235
|
fields: ['name^5', 'id^5']
|
|
331
236
|
}
|
|
332
237
|
},
|
|
333
238
|
{
|
|
334
239
|
match_phrase_prefix: {
|
|
335
|
-
name:
|
|
240
|
+
name: '41853 69 SER-69 allan DoNALD Vikram RalPH'
|
|
336
241
|
}
|
|
337
242
|
},
|
|
338
243
|
{
|
|
@@ -345,13 +250,17 @@ describe('projectPipeline', function () {
|
|
|
345
250
|
must: [
|
|
346
251
|
{
|
|
347
252
|
term: {
|
|
348
|
-
'fields.id': {
|
|
253
|
+
'fields.id': {
|
|
254
|
+
value:
|
|
255
|
+
'4ef2760a-083a-466b-b761-667856aeb5ee'
|
|
256
|
+
}
|
|
349
257
|
}
|
|
350
258
|
},
|
|
351
259
|
{
|
|
352
260
|
match: {
|
|
353
261
|
'fields.text.analyzed': {
|
|
354
|
-
query:
|
|
262
|
+
query:
|
|
263
|
+
'41853 69 SER-69 allan DoNALD Vikram RalPH',
|
|
355
264
|
operator: 'or'
|
|
356
265
|
}
|
|
357
266
|
}
|
|
@@ -375,7 +284,10 @@ describe('projectPipeline', function () {
|
|
|
375
284
|
must: [
|
|
376
285
|
{
|
|
377
286
|
term: {
|
|
378
|
-
'fields.id': {
|
|
287
|
+
'fields.id': {
|
|
288
|
+
value:
|
|
289
|
+
'4ef2760a-083a-466b-b761-667856aeb5ee'
|
|
290
|
+
}
|
|
379
291
|
}
|
|
380
292
|
},
|
|
381
293
|
{
|
|
@@ -384,14 +296,16 @@ describe('projectPipeline', function () {
|
|
|
384
296
|
{
|
|
385
297
|
match: {
|
|
386
298
|
'fields.text.analyzed': {
|
|
387
|
-
query:
|
|
299
|
+
query:
|
|
300
|
+
'41853 69 SER-69 allan DoNALD Vikram RalPH',
|
|
388
301
|
operator: 'and'
|
|
389
302
|
}
|
|
390
303
|
}
|
|
391
304
|
},
|
|
392
305
|
{
|
|
393
306
|
match_phrase_prefix: {
|
|
394
|
-
'fields.text.analyzed':
|
|
307
|
+
'fields.text.analyzed':
|
|
308
|
+
'41853 69 SER-69 allan DoNALD Vikram RalPH'
|
|
395
309
|
}
|
|
396
310
|
}
|
|
397
311
|
]
|