@eeacms/volto-cca-policy 0.1.41 → 0.1.42
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 +9 -0
- package/package.json +1 -1
- package/src/search/config.js +19 -5
- package/src/search/facets-health.js +17 -25
- package/src/search/facets.js +28 -26
- package/src/search/utils.js +29 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,15 @@ 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
|
+
### [0.1.42](https://github.com/eea/volto-cca-policy/compare/0.1.41...0.1.42) - 5 September 2023
|
|
8
|
+
|
|
9
|
+
#### :hammer_and_wrench: Others
|
|
10
|
+
|
|
11
|
+
- Refs #257400 - Add Key Type Measure - facet vocabulary terms instead of keys. [GhitaB - [`53070bc`](https://github.com/eea/volto-cca-policy/commit/53070bc9b32f31d1c7e64a05eb8a7409c8021029)]
|
|
12
|
+
- Refs #257400 - Add Key Type Measure - test vocab. [GhitaB - [`d42e3d3`](https://github.com/eea/volto-cca-policy/commit/d42e3d3c88585461a7f07deac4eaa853787fefbd)]
|
|
13
|
+
- Refs #257400 - Add Key Type Measure facet for ccaSearch. [GhitaB - [`242fa6d`](https://github.com/eea/volto-cca-policy/commit/242fa6dea274b1e9197642e42b5f6119a25abccc)]
|
|
14
|
+
- Also fix health catalog [Tiberiu Ichim - [`6695897`](https://github.com/eea/volto-cca-policy/commit/6695897b6e70b3d3708e2ef895b5bd5a9b2fe9f5)]
|
|
15
|
+
- Fix expiration date in search catalogue [Tiberiu Ichim - [`543dd0b`](https://github.com/eea/volto-cca-policy/commit/543dd0b4e950ea93dd35f2bfa9ceb4061a74e1fd)]
|
|
7
16
|
### [0.1.41](https://github.com/eea/volto-cca-policy/compare/0.1.40...0.1.41) - 1 September 2023
|
|
8
17
|
|
|
9
18
|
#### :hammer_and_wrench: Others
|
package/package.json
CHANGED
package/src/search/config.js
CHANGED
|
@@ -50,6 +50,19 @@ export default function installMainSearch(config) {
|
|
|
50
50
|
cluster_name: {
|
|
51
51
|
cca: 'Climate-ADAPT',
|
|
52
52
|
},
|
|
53
|
+
'cca_key_type_measure.keyword': {
|
|
54
|
+
A1: 'A1: Policy Instruments',
|
|
55
|
+
A2: 'A2: Management and planning',
|
|
56
|
+
A3: 'A3: Coordination cooperation and networks',
|
|
57
|
+
B1: 'B1: Financing incentive instruments',
|
|
58
|
+
B2: 'B2: Insurance and risk sharing instruments',
|
|
59
|
+
C1: 'C1: Grey options',
|
|
60
|
+
C2: 'C2: Technological options',
|
|
61
|
+
D1: 'D1: Green options',
|
|
62
|
+
D2: 'D2: Blue options',
|
|
63
|
+
E1: 'E1: Information and awareness raising',
|
|
64
|
+
E2: 'E2: Capacity building empowering and lifestyle practices',
|
|
65
|
+
},
|
|
53
66
|
},
|
|
54
67
|
runtime_mappings: build_runtime_mappings(clusters),
|
|
55
68
|
};
|
|
@@ -61,11 +74,11 @@ export default function installMainSearch(config) {
|
|
|
61
74
|
cluster_name: 'cca',
|
|
62
75
|
},
|
|
63
76
|
});
|
|
64
|
-
ccaSearch.permanentFilters.push({
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
});
|
|
77
|
+
// ccaSearch.permanentFilters.push({
|
|
78
|
+
// term: {
|
|
79
|
+
// cca_include_in_search: 'true',
|
|
80
|
+
// },
|
|
81
|
+
// });
|
|
69
82
|
|
|
70
83
|
ccaSearch.permanentFilters.push({
|
|
71
84
|
terms: {
|
|
@@ -172,6 +185,7 @@ export default function installMainSearch(config) {
|
|
|
172
185
|
config.searchui.ccaSearch.host =
|
|
173
186
|
process.env.RAZZLE_ES_PROXY_ADDR || getClientProxyAddress();
|
|
174
187
|
}
|
|
188
|
+
|
|
175
189
|
// console.log(config.searchui.ccaSearch);
|
|
176
190
|
|
|
177
191
|
return config;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { booleanFacet } from '@eeacms/search';
|
|
2
|
+
import { getTodayWithTime } from './utils';
|
|
3
|
+
|
|
1
4
|
const special = [
|
|
2
5
|
{
|
|
3
6
|
field: 'issued.date',
|
|
@@ -53,43 +56,32 @@ const special = [
|
|
|
53
56
|
},
|
|
54
57
|
},
|
|
55
58
|
|
|
56
|
-
{
|
|
59
|
+
booleanFacet(() => ({
|
|
57
60
|
field: 'IncludeArchived',
|
|
58
61
|
label: 'Include archived content',
|
|
59
|
-
|
|
62
|
+
id: 'archived-facet',
|
|
63
|
+
showInFacetsList: false,
|
|
64
|
+
showInSecondaryFacetsList: true,
|
|
65
|
+
isFilter: true, // filters don't need facet options to show up
|
|
66
|
+
|
|
67
|
+
// we want this to be applied by default
|
|
68
|
+
// when the facet is checked, then apply the `on` key:
|
|
60
69
|
off: {
|
|
61
70
|
constant_score: {
|
|
62
71
|
filter: {
|
|
63
72
|
bool: {
|
|
64
73
|
should: [
|
|
65
|
-
{
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
exists: {
|
|
69
|
-
field: 'expires',
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
range: {
|
|
76
|
-
expires: {
|
|
77
|
-
gte: '2023-04-27T11:52:29Z',
|
|
78
|
-
},
|
|
79
|
-
},
|
|
80
|
-
},
|
|
74
|
+
{ bool: { must_not: { exists: { field: 'expires' } } } },
|
|
75
|
+
// Functions should be supported in the buildFilters
|
|
76
|
+
{ range: { expires: { gte: getTodayWithTime() } } },
|
|
81
77
|
],
|
|
82
78
|
},
|
|
83
79
|
},
|
|
84
80
|
},
|
|
85
81
|
},
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
id: 'archived-facet',
|
|
90
|
-
showInSecondaryFacetsList: true,
|
|
91
|
-
isFilter: true,
|
|
92
|
-
},
|
|
82
|
+
on: null,
|
|
83
|
+
})),
|
|
84
|
+
|
|
93
85
|
{
|
|
94
86
|
field: 'op_cluster',
|
|
95
87
|
factory: 'MultiTermFacet',
|
package/src/search/facets.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { booleanFacet } from '@eeacms/search';
|
|
2
|
+
import { getTodayWithTime } from './utils';
|
|
3
|
+
|
|
1
4
|
const facets = [
|
|
2
5
|
{
|
|
3
6
|
field: 'cca_adaptation_sectors.keyword',
|
|
@@ -12,44 +15,31 @@ const facets = [
|
|
|
12
15
|
showAllOptions: true,
|
|
13
16
|
alwaysVisible: true,
|
|
14
17
|
},
|
|
15
|
-
|
|
16
|
-
{
|
|
18
|
+
booleanFacet(() => ({
|
|
17
19
|
field: 'IncludeArchived',
|
|
18
20
|
label: 'Include archived content',
|
|
19
|
-
|
|
21
|
+
id: 'archived-facet',
|
|
22
|
+
showInFacetsList: false,
|
|
23
|
+
showInSecondaryFacetsList: true,
|
|
24
|
+
isFilter: true, // filters don't need facet options to show up
|
|
25
|
+
|
|
26
|
+
// we want this to be applied by default
|
|
27
|
+
// when the facet is checked, then apply the `on` key:
|
|
20
28
|
off: {
|
|
21
29
|
constant_score: {
|
|
22
30
|
filter: {
|
|
23
31
|
bool: {
|
|
24
32
|
should: [
|
|
25
|
-
{
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
exists: {
|
|
29
|
-
field: 'expires',
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
range: {
|
|
36
|
-
expires: {
|
|
37
|
-
gte: '2023-04-27T11:52:29Z',
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
},
|
|
33
|
+
{ bool: { must_not: { exists: { field: 'expires' } } } },
|
|
34
|
+
// Functions should be supported in the buildFilters
|
|
35
|
+
{ range: { expires: { gte: getTodayWithTime() } } },
|
|
41
36
|
],
|
|
42
37
|
},
|
|
43
38
|
},
|
|
44
39
|
},
|
|
45
40
|
},
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
showInFacetsList: false,
|
|
49
|
-
id: 'archived-facet',
|
|
50
|
-
showInSecondaryFacetsList: true,
|
|
51
|
-
isFilter: true,
|
|
52
|
-
},
|
|
41
|
+
on: null,
|
|
42
|
+
})),
|
|
53
43
|
{
|
|
54
44
|
field: 'op_cluster',
|
|
55
45
|
factory: 'MultiTermFacet',
|
|
@@ -1190,6 +1180,18 @@ const facets = [
|
|
|
1190
1180
|
sortOn: 'custom',
|
|
1191
1181
|
sortOnCustomLabel: 'Alphabetical',
|
|
1192
1182
|
},
|
|
1183
|
+
{
|
|
1184
|
+
field: 'cca_key_type_measure.keyword',
|
|
1185
|
+
factory: 'MultiTermFacet',
|
|
1186
|
+
label: 'Key Type Measure',
|
|
1187
|
+
showInFacetsList: true,
|
|
1188
|
+
filterType: 'any',
|
|
1189
|
+
isFilterable: false,
|
|
1190
|
+
show: 10000,
|
|
1191
|
+
isMulti: true,
|
|
1192
|
+
sortOn: 'custom',
|
|
1193
|
+
sortOnCustomLabel: 'Alphabetical',
|
|
1194
|
+
},
|
|
1193
1195
|
{
|
|
1194
1196
|
field: 'cca_funding_programme.keyword',
|
|
1195
1197
|
factory: 'MultiTermFacet',
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export function getTodayWithTime() {
|
|
2
|
+
const d = new Date();
|
|
3
|
+
const month = d.getMonth() + 1;
|
|
4
|
+
const day = d.getDate();
|
|
5
|
+
const hour = d.getHours();
|
|
6
|
+
const minute = d.getMinutes();
|
|
7
|
+
const second = d.getSeconds();
|
|
8
|
+
|
|
9
|
+
const output = [
|
|
10
|
+
d.getFullYear(),
|
|
11
|
+
'-',
|
|
12
|
+
month < 10 ? '0' : '',
|
|
13
|
+
month,
|
|
14
|
+
'-',
|
|
15
|
+
day < 10 ? '0' : '',
|
|
16
|
+
day,
|
|
17
|
+
'T',
|
|
18
|
+
hour < 10 ? '0' : '',
|
|
19
|
+
hour,
|
|
20
|
+
':',
|
|
21
|
+
minute < 10 ? '0' : '',
|
|
22
|
+
minute,
|
|
23
|
+
':',
|
|
24
|
+
second < 10 ? '0' : '',
|
|
25
|
+
second,
|
|
26
|
+
'Z',
|
|
27
|
+
].join('');
|
|
28
|
+
return output;
|
|
29
|
+
}
|