@outliant/sunrise-utils 1.1.0 → 1.1.1
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 +10 -0
- package/helpers/searchFilter.js +44 -0
- package/lib/projectPipeline.js +14 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,9 +4,19 @@ 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.1.1](https://github.com/outliant/sunrise-utils/compare/1.1.0...1.1.1)
|
|
8
|
+
|
|
9
|
+
- chore: add search for projectIds [`#5`](https://github.com/outliant/sunrise-utils/pull/5)
|
|
10
|
+
- chore: add match_phrase_prefix search for project fields [`#6`](https://github.com/outliant/sunrise-utils/pull/6)
|
|
11
|
+
- chore: revert taskPipeline [`3fb9c24`](https://github.com/outliant/sunrise-utils/commit/3fb9c2486b1459a0b33050e6691963e8aa04cfcf)
|
|
12
|
+
- chore: update projectId filter query [`dbe2f3c`](https://github.com/outliant/sunrise-utils/commit/dbe2f3c6cc40c470d02c78911a1fc0ba30cda900)
|
|
13
|
+
|
|
7
14
|
#### [1.1.0](https://github.com/outliant/sunrise-utils/compare/1.0.11...1.1.0)
|
|
8
15
|
|
|
16
|
+
> 13 April 2023
|
|
17
|
+
|
|
9
18
|
- chore: support task age color #860q9c397 [`50d79a7`](https://github.com/outliant/sunrise-utils/commit/50d79a78e309c70d7eac0f5533686bd65c1167a7)
|
|
19
|
+
- chore(release): 1.1.0 [`73ee00e`](https://github.com/outliant/sunrise-utils/commit/73ee00e07226e06fcfbf4d8c96ba87b8970ce312)
|
|
10
20
|
|
|
11
21
|
#### [1.0.11](https://github.com/outliant/sunrise-utils/compare/1.0.10...1.0.11)
|
|
12
22
|
|
package/helpers/searchFilter.js
CHANGED
|
@@ -85,6 +85,50 @@ module.exports = (query = {}, searchFields = []) => {
|
|
|
85
85
|
min_score: 15
|
|
86
86
|
}
|
|
87
87
|
});
|
|
88
|
+
|
|
89
|
+
should.push({
|
|
90
|
+
bool: {
|
|
91
|
+
must: [
|
|
92
|
+
{
|
|
93
|
+
nested: {
|
|
94
|
+
path: 'fields',
|
|
95
|
+
query: {
|
|
96
|
+
bool: {
|
|
97
|
+
must: [
|
|
98
|
+
{
|
|
99
|
+
term: {
|
|
100
|
+
'fields.id': {
|
|
101
|
+
value: projectFields[i]
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
bool: {
|
|
107
|
+
should: [
|
|
108
|
+
{
|
|
109
|
+
match: {
|
|
110
|
+
[`fields.text.analyzed`]: {
|
|
111
|
+
query: searchString,
|
|
112
|
+
operator: 'and'
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
match_phrase_prefix: {
|
|
118
|
+
[`fields.text.analyzed`]: searchString
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
]
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
]
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
]
|
|
130
|
+
}
|
|
131
|
+
});
|
|
88
132
|
}
|
|
89
133
|
}
|
|
90
134
|
|
package/lib/projectPipeline.js
CHANGED
|
@@ -45,6 +45,20 @@ class ProjectPipeline {
|
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
if (query.projectIds && query.projectIds.length) {
|
|
49
|
+
const should = query.projectIds.map(projectId => {
|
|
50
|
+
return {
|
|
51
|
+
match: {
|
|
52
|
+
_id: projectId
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
mustQuery.push({
|
|
58
|
+
bool: { should }
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
48
62
|
if (!filters.length) {
|
|
49
63
|
return {
|
|
50
64
|
bool: {
|