@eeacms/volto-globalsearch 1.0.13 → 1.0.15

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 CHANGED
@@ -4,6 +4,20 @@ 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.0.15](https://github.com/eea/volto-globalsearch/compare/1.0.14...1.0.15) - 14 March 2023
8
+
9
+ #### :hammer_and_wrench: Others
10
+
11
+ - use registry.resolve for healthcheck [Zoltan Szabo - [`77ac70f`](https://github.com/eea/volto-globalsearch/commit/77ac70f2b82c8db9a22f9a6d3ccae901d9b10002)]
12
+ - Add healthcheck [Tiberiu Ichim - [`1860323`](https://github.com/eea/volto-globalsearch/commit/1860323629fa54fbd52ecf9d16ac5ccd0a3a8f7d)]
13
+ ### [1.0.14](https://github.com/eea/volto-globalsearch/compare/1.0.13...1.0.14) - 10 March 2023
14
+
15
+ #### :hammer_and_wrench: Others
16
+
17
+ - test(Jenkinsfile): Use latest stable volto for testing [Zoltan Szabo - [`f0f9449`](https://github.com/eea/volto-globalsearch/commit/f0f94497767e6a7cf8ecb721fabddba757d7aebd)]
18
+ - use the correct thumbnails for the new eea site [Zoltan Szabo - [`5e2a38f`](https://github.com/eea/volto-globalsearch/commit/5e2a38ffe2559b9d64e6431cf3b08bfe8c9b4bae)]
19
+ - update landing page config [Zoltan Szabo - [`e00c526`](https://github.com/eea/volto-globalsearch/commit/e00c5268bad30215808497ec0f1b8072a7288f05)]
20
+ - use current year for Publishing year facet [Zoltan Szabo - [`01e6cf2`](https://github.com/eea/volto-globalsearch/commit/01e6cf26dadd5e43d121cf2230dad32da7d12d79)]
7
21
  ### [1.0.13](https://github.com/eea/volto-globalsearch/compare/1.0.12...1.0.13) - 7 March 2023
8
22
 
9
23
  #### :hammer_and_wrench: Others
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-globalsearch",
3
- "version": "1.0.13",
3
+ "version": "1.0.15",
4
4
  "description": "@eeacms/volto-globalsearch: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -48,6 +48,9 @@ const languageCodes = [
48
48
  'tr',
49
49
  ];
50
50
 
51
+ const today = new Date();
52
+ const currentYear = today.getFullYear();
53
+
51
54
  const facets = [
52
55
  booleanFacet(() => ({
53
56
  field: 'IncludeArchived',
@@ -167,7 +170,7 @@ const facets = [
167
170
  // TODO: implement split in buckets
168
171
  ranges: makeRange({
169
172
  step: 1,
170
- normalRange: [1994, 2022],
173
+ normalRange: [1994, currentYear],
171
174
  includeOutlierStart: false,
172
175
  includeOutlierEnd: false,
173
176
  }),
@@ -22,7 +22,8 @@ const globalSearchBaseConfig = {
22
22
  runtime_mappings: build_runtime_mappings(clusters),
23
23
  useSearchPhrases: false,
24
24
  searchAsYouType: false,
25
- landingPageURL: '/en/advanced-search',
25
+ landingPageURL: null,
26
+ healthcheck: 'getGlobalSearchHealthcheck',
26
27
  getActiveFilters: 'getGlobalSearchActiveFilters',
27
28
 
28
29
  ...vocabs,
@@ -3,6 +3,7 @@ import cloneDeep from 'lodash.clonedeep';
3
3
  import globalSearchBaseConfig from './global-search-base-config.js';
4
4
 
5
5
  let globalSearchConfig = cloneDeep(globalSearchBaseConfig);
6
+ globalSearchConfig.landingPageURL = '/en/advanced-search';
6
7
 
7
8
  globalSearchConfig.facets = globalSearchConfig.facets.filter(
8
9
  (facet) => facet['field'] !== 'subject.keyword',
@@ -0,0 +1,23 @@
1
+ import runRequest from '@eeacms/search/lib/runRequest';
2
+ import buildRequest from '@eeacms/search/lib/search/query';
3
+
4
+ export default function healthcheck(appConfig) {
5
+ // is index ok?
6
+ // return index update date
7
+ // run default query, see number of results
8
+ // nlpservice provides answer based on extracted term
9
+ // number of documents with error in data raw, type of error
10
+
11
+ return new Promise((resolve, reject) => {
12
+ const body = buildRequest({ filters: [] }, appConfig);
13
+ runRequest(body, appConfig).then((resp) => {
14
+ let total;
15
+ try {
16
+ total = resp.body.hits.total.value;
17
+ resolve({ documentCount: total });
18
+ } catch {
19
+ reject({ total: -1 });
20
+ }
21
+ });
22
+ });
23
+ }
@@ -4,6 +4,8 @@ import {
4
4
  isFilterValueDefaultValue,
5
5
  } from '@eeacms/search';
6
6
  import { getGlobalsearchThumbUrl, getGlobalsearchIconUrl } from './../utils';
7
+ import healthcheck from './healthcheck';
8
+
7
9
  import { typesForClustersOptionsFilter } from './clusters';
8
10
 
9
11
  import { UniversalCard } from '@eeacms/volto-listing-block';
@@ -108,6 +110,8 @@ export default function install(config) {
108
110
  },
109
111
  };
110
112
 
113
+ config.resolve.getGlobalSearchHealthcheck = healthcheck;
114
+
111
115
  config.resolve.getGlobalsearchIconUrl = getGlobalsearchIconUrl(
112
116
  contentTypeNormalize,
113
117
  );
@@ -83,6 +83,18 @@ export default {
83
83
  // clusterIcons,
84
84
  sortField: 'issued.date',
85
85
  sortDirection: 'desc',
86
+ default_filters: [
87
+ {
88
+ field: 'language',
89
+ values: ['en'],
90
+ },
91
+ ],
92
+ //TODO: This is a temporary solution, until we find another way to detect if there was any interaction on the landing page
93
+ filterForAllResults: {
94
+ field: 'items_count_language',
95
+ value: 1,
96
+ },
97
+
86
98
  sections: [
87
99
  {
88
100
  id: 'topics',
package/src/utils.js CHANGED
@@ -167,7 +167,8 @@ export const getGlobalsearchThumbUrl = (contentTypeNormalize) => (
167
167
  result.about?.raw?.indexOf('://biodiversity.europa.eu') !== -1 ||
168
168
  result.about?.raw?.indexOf('://forest.eea.europa.eu') !== -1 ||
169
169
  result.about?.raw?.indexOf('://climate-energy.eea.europa.eu') !== -1 ||
170
- result.about?.raw?.indexOf('://industry.eea.europa.eu') !== -1
170
+ result.about?.raw?.indexOf('://industry.eea.europa.eu') !== -1 ||
171
+ result.about?.raw?.indexOf('://www.eea.europa.eu/en/') !== -1
171
172
  ) {
172
173
  if (result.image_preview) {
173
174
  image = result.image_preview.raw;
@@ -175,8 +176,9 @@ export const getGlobalsearchThumbUrl = (contentTypeNormalize) => (
175
176
  }
176
177
  }
177
178
  if (
178
- result.about?.raw?.startsWith('http://www.eea.europa.eu') ||
179
- result.about?.raw?.startsWith('https://www.eea.europa.eu')
179
+ (result.about?.raw?.startsWith('http://www.eea.europa.eu') ||
180
+ result.about?.raw?.startsWith('https://www.eea.europa.eu')) &&
181
+ result.about?.raw?.indexOf('://www.eea.europa.eu/en/') === -1
180
182
  ) {
181
183
  image = result.about.raw + '/image_preview';
182
184
  has_img = true;