@eeacms/volto-globalsearch 1.0.10 → 1.0.12

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,22 @@ 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.12](https://github.com/eea/volto-globalsearch/compare/1.0.11...1.0.12) - 1 March 2023
8
+
9
+ #### :hammer_and_wrench: Others
10
+
11
+ - Prettier [Tiberiu Ichim - [`d2fced6`](https://github.com/eea/volto-globalsearch/commit/d2fced6fb614b7b2dca3ff1425ce33400a085a5d)]
12
+ - removed unused imports [Zoltan Szabo - [`f6d7dc4`](https://github.com/eea/volto-globalsearch/commit/f6d7dc4f787005027a102fb513aa2e8aba5ffba9)]
13
+ - Added 'Publication reference' to the 'Others' cluster [Zoltan Szabo - [`73e289d`](https://github.com/eea/volto-globalsearch/commit/73e289deb8e841610575ff92095506b7279ecbc5)]
14
+ - Refs #241801; Added searchengine with new facet for keywords [Zoltan Szabo - [`654f3ca`](https://github.com/eea/volto-globalsearch/commit/654f3ca1ba79190c721bf200f24808b31c79be8f)]
15
+ ### [1.0.11](https://github.com/eea/volto-globalsearch/compare/1.0.10...1.0.11) - 14 February 2023
16
+
17
+ #### :hammer_and_wrench: Others
18
+
19
+ - Fix nbame [Tiberiu Ichim - [`57ded54`](https://github.com/eea/volto-globalsearch/commit/57ded54282f232b8598fe9847bc7619ba970c541)]
20
+ - Updated facet names [Zoltan Szabo - [`798f43b`](https://github.com/eea/volto-globalsearch/commit/798f43bcbdbebac3a5566c58f90ee9e394d66354)]
21
+ - Whitespace [Tiberiu Ichim - [`f02946b`](https://github.com/eea/volto-globalsearch/commit/f02946bb03d942b879d0cab1d94ae835ad7207e3)]
22
+ - updated landing page and facets [Zoltan Szabo - [`3d04325`](https://github.com/eea/volto-globalsearch/commit/3d04325df54c5f502f951bc1573cd40eb385b435)]
7
23
  ### [1.0.10](https://github.com/eea/volto-globalsearch/compare/1.0.9...1.0.10) - 9 February 2023
8
24
 
9
25
  #### :hammer_and_wrench: Others
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-globalsearch",
3
- "version": "1.0.10",
3
+ "version": "1.0.12",
4
4
  "description": "@eeacms/volto-globalsearch: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -59,6 +59,7 @@ export const clusters = {
59
59
  'Tool',
60
60
  'Case study',
61
61
  'External data reference',
62
+ 'Publication reference',
62
63
  ], // this will be transformed in "single type clusters".
63
64
  defaultResultView: 'horizontalCard',
64
65
  },
@@ -101,6 +101,15 @@ const facets = [
101
101
  showAllOptions: true, // show all options (even if 0) in modal facet
102
102
  alwaysVisible: true,
103
103
  }),
104
+ multiTermFacet({
105
+ field: 'subject.keyword',
106
+ isFilterable: true,
107
+ isMulti: true,
108
+ label: 'Keywords',
109
+ show: 10000,
110
+ showAllOptions: true, // show all options (even if 0) in modal facet
111
+ alwaysVisible: false,
112
+ }),
104
113
  multiTermFacet({
105
114
  field: 'spatial',
106
115
  isFilterable: true,
@@ -111,7 +120,7 @@ const facets = [
111
120
  iconsFamily: 'Countries',
112
121
  enableExact: true,
113
122
  sortOn: 'value',
114
- alwaysVisible: true,
123
+ alwaysVisible: false,
115
124
  }),
116
125
  multiTermFacet({
117
126
  field: 'op_cluster',
@@ -122,15 +131,24 @@ const facets = [
122
131
  showInFacetsList: false,
123
132
  ignoreNLPWhenActive: true,
124
133
  }),
134
+ multiTermFacet({
135
+ field: 'cluster_name',
136
+ isFilterable: false,
137
+ isMulti: true,
138
+ label: 'Websites',
139
+ iconsFamily: 'Sources',
140
+ alwaysVisible: true,
141
+ }),
125
142
 
126
143
  multiTermFacet({
127
144
  field: 'places',
128
145
  isFilterable: true,
129
146
  isMulti: true,
130
- label: 'Regions/Places/Cities/Seas...',
147
+ label: 'Regions/Places',
131
148
  blacklist: placesBlacklist,
132
149
  show: 10000,
133
150
  showAllOptions: true, // show all options (even if 0) in modal facet
151
+ alwaysVisible: true,
134
152
  }),
135
153
  multiTermFacet({
136
154
  field: 'objectProvides',
@@ -141,13 +159,6 @@ const facets = [
141
159
  //whitelist: objectProvidesWhitelist,
142
160
  optionsFilter: 'typesForClustersOptionsFilter',
143
161
  }),
144
- multiTermFacet({
145
- field: 'cluster_name',
146
- isFilterable: false,
147
- isMulti: true,
148
- label: 'Sources',
149
- iconsFamily: 'Sources',
150
- }),
151
162
  histogramFacet({
152
163
  field: 'year',
153
164
  // isFilterable: false,
@@ -0,0 +1,120 @@
1
+ import { build_runtime_mappings } from '../utils';
2
+ import clusterParams, { clusters } from './clusters';
3
+
4
+ import facets from './facets';
5
+ import views from './views';
6
+ import query from './query';
7
+ import filters from './filters';
8
+ import download from './download';
9
+ import vocabs from './vocabulary';
10
+
11
+ import objectProvidesWhitelist from './json/objectProvidesWhitelist.json';
12
+ import spatialWhitelist from './json/spatialWhitelist.json';
13
+ import placesBlacklist from './json/placesBlacklist.json';
14
+ import typesWhitelist from './json/typesWhitelist.json';
15
+
16
+ const globalSearchBaseConfig = {
17
+ title: 'Global search and catalogue',
18
+ layoutComponent: 'TopFilterLayout',
19
+ contentBodyComponent: 'FilterAsideContentView',
20
+ enableNLP: true, // enables NLP capabilities
21
+ facetsListComponent: 'DropdownFacetsList',
22
+ runtime_mappings: build_runtime_mappings(clusters),
23
+ useSearchPhrases: false,
24
+ searchAsYouType: false,
25
+ landingPageURL: '/en/advanced-search',
26
+ getActiveFilters: 'getGlobalSearchActiveFilters',
27
+
28
+ ...vocabs,
29
+ ...facets,
30
+ ...views,
31
+ ...query,
32
+ ...filters,
33
+ ...download,
34
+ ...clusterParams,
35
+
36
+ sourceExcludedFields: ['embedding'], // don't need these in results
37
+ // 'fulltext',
38
+
39
+ // these are used to "clean" the values in the results.
40
+ field_filters: {
41
+ type: {
42
+ whitelist: typesWhitelist,
43
+ },
44
+ objectProvides: {
45
+ whitelist: objectProvidesWhitelist,
46
+ },
47
+ spatial: {
48
+ whitelist: spatialWhitelist,
49
+ },
50
+ places: {
51
+ blacklist: placesBlacklist,
52
+ },
53
+ },
54
+
55
+ highlight: {
56
+ queryParams: {
57
+ fragment_size: 200,
58
+ number_of_fragments: 3,
59
+ },
60
+ fields: ['description.highlight'],
61
+ queryBuilder: {
62
+ factory: 'highlightQueryBuilder',
63
+ },
64
+ },
65
+
66
+ sortOptions: [
67
+ {
68
+ name: 'Title a-z',
69
+ value: 'title.index',
70
+ direction: 'asc',
71
+ },
72
+ {
73
+ name: 'Title z-a',
74
+ value: 'title.index',
75
+ direction: 'desc',
76
+ },
77
+ {
78
+ name: 'Oldest',
79
+ value: 'issued.date',
80
+ direction: 'asc',
81
+ },
82
+ {
83
+ name: 'Newest',
84
+ value: 'issued.date',
85
+ direction: 'desc',
86
+ },
87
+ ],
88
+
89
+ defaultPromptQueries: [
90
+ 'what is the status of our forests',
91
+ 'what is PFAS?',
92
+ 'how does PFAS get into human?',
93
+ 'what is the cumulative surface area of the Natura 2000?',
94
+ 'what percentage of europe population is connected to waste water treatement?',
95
+ 'How is the status of fish species in Europe?',
96
+ 'What is the BISE?',
97
+ 'how much does transport contributes to GHG emissions in EU?',
98
+ 'Which cities in Europe have the worst air quality?',
99
+ 'What car is best for the environment?',
100
+ 'What transport mode is best for the environment?',
101
+ 'What EU legislation safeguards our water?',
102
+ 'What is land accounting?',
103
+ 'What countries had the highest land take in the EEA-39 between 2000 and 2018?',
104
+ 'Why is urban sprawl bad?',
105
+ 'what are controlled substances',
106
+ 'what is plastic',
107
+ 'What year did car manufacturers meet their binding emissions target?',
108
+ 'What is the percentage of surface water bodies with less than good status?',
109
+ 'What is the most common pollutant in water bodies in Europe?',
110
+ 'Where can I access greenhouse gas data',
111
+ 'What is the trend on greenhouse gas emissions from transport',
112
+ 'what is the best transport mode',
113
+ 'what are ecosystem services',
114
+ 'bathing water quality',
115
+ 'greenhouse gas emissions trends',
116
+ 'waste generation trends',
117
+ ],
118
+ };
119
+
120
+ export default globalSearchBaseConfig;
@@ -1,120 +1,11 @@
1
- import { build_runtime_mappings } from '../utils';
2
- import clusterParams, { clusters } from './clusters';
1
+ import cloneDeep from 'lodash.clonedeep';
3
2
 
4
- import facets from './facets';
5
- import views from './views';
6
- import query from './query';
7
- import filters from './filters';
8
- import download from './download';
9
- import vocabs from './vocabulary';
3
+ import globalSearchBaseConfig from './global-search-base-config.js';
10
4
 
11
- import objectProvidesWhitelist from './json/objectProvidesWhitelist.json';
12
- import spatialWhitelist from './json/spatialWhitelist.json';
13
- import placesBlacklist from './json/placesBlacklist.json';
14
- import typesWhitelist from './json/typesWhitelist.json';
5
+ let globalSearchConfig = cloneDeep(globalSearchBaseConfig);
15
6
 
16
- const globalSearchConfig = {
17
- title: 'Global search and catalogue',
18
- layoutComponent: 'TopFilterLayout',
19
- contentBodyComponent: 'FilterAsideContentView',
20
- enableNLP: true, // enables NLP capabilities
21
- facetsListComponent: 'DropdownFacetsList',
22
- runtime_mappings: build_runtime_mappings(clusters),
23
- useSearchPhrases: false,
24
- searchAsYouType: false,
25
- landingPageURL: '/en/advanced-search',
26
- getActiveFilters: 'getGlobalSearchActiveFilters',
27
-
28
- ...vocabs,
29
- ...facets,
30
- ...views,
31
- ...query,
32
- ...filters,
33
- ...download,
34
- ...clusterParams,
35
-
36
- sourceExcludedFields: ['embedding'], // don't need these in results
37
- // 'fulltext',
38
-
39
- // these are used to "clean" the values in the results.
40
- field_filters: {
41
- type: {
42
- whitelist: typesWhitelist,
43
- },
44
- objectProvides: {
45
- whitelist: objectProvidesWhitelist,
46
- },
47
- spatial: {
48
- whitelist: spatialWhitelist,
49
- },
50
- places: {
51
- blacklist: placesBlacklist,
52
- },
53
- },
54
-
55
- highlight: {
56
- queryParams: {
57
- fragment_size: 200,
58
- number_of_fragments: 3,
59
- },
60
- fields: ['description.highlight'],
61
- queryBuilder: {
62
- factory: 'highlightQueryBuilder',
63
- },
64
- },
65
-
66
- sortOptions: [
67
- {
68
- name: 'Title a-z',
69
- value: 'title.index',
70
- direction: 'asc',
71
- },
72
- {
73
- name: 'Title z-a',
74
- value: 'title.index',
75
- direction: 'desc',
76
- },
77
- {
78
- name: 'Oldest',
79
- value: 'issued.date',
80
- direction: 'asc',
81
- },
82
- {
83
- name: 'Newest',
84
- value: 'issued.date',
85
- direction: 'desc',
86
- },
87
- ],
88
-
89
- defaultPromptQueries: [
90
- 'what is the status of our forests',
91
- 'what is PFAS?',
92
- 'how does PFAS get into human?',
93
- 'what is the cumulative surface area of the Natura 2000?',
94
- 'what percentage of europe population is connected to waste water treatement?',
95
- 'How is the status of fish species in Europe?',
96
- 'What is the BISE?',
97
- 'how much does transport contributes to GHG emissions in EU?',
98
- 'Which cities in Europe have the worst air quality?',
99
- 'What car is best for the environment?',
100
- 'What transport mode is best for the environment?',
101
- 'What EU legislation safeguards our water?',
102
- 'What is land accounting?',
103
- 'What countries had the highest land take in the EEA-39 between 2000 and 2018?',
104
- 'Why is urban sprawl bad?',
105
- 'what are controlled substances',
106
- 'what is plastic',
107
- 'What year did car manufacturers meet their binding emissions target?',
108
- 'What is the percentage of surface water bodies with less than good status?',
109
- 'What is the most common pollutant in water bodies in Europe?',
110
- 'Where can I access greenhouse gas data',
111
- 'What is the trend on greenhouse gas emissions from transport',
112
- 'what is the best transport mode',
113
- 'what are ecosystem services',
114
- 'bathing water quality',
115
- 'greenhouse gas emissions trends',
116
- 'waste generation trends',
117
- ],
118
- };
7
+ globalSearchConfig.facets = globalSearchConfig.facets.filter(
8
+ (facet) => facet['field'] !== 'subject.keyword',
9
+ );
119
10
 
120
11
  export default globalSearchConfig;
@@ -13,6 +13,8 @@ import { UniversalCard } from '@eeacms/volto-listing-block';
13
13
  import contentTypeNormalize from './json/contentTypeNormalize.json';
14
14
  import globalSearchConfig from './global-search-config.js';
15
15
 
16
+ import globalSearchBaseConfig from './global-search-base-config.js';
17
+
16
18
  const getClientProxyAddress = () => {
17
19
  const url = new URL(window.location);
18
20
  url.pathname = '';
@@ -67,6 +69,11 @@ export default function install(config) {
67
69
  host: process.env.RAZZLE_ES_PROXY_ADDR || 'http://localhost:3000',
68
70
  };
69
71
 
72
+ config.searchui.globalsearchbase = {
73
+ ...mergeConfig(globalSearchBaseConfig, config.searchui.default),
74
+ elastic_index: 'es',
75
+ host: process.env.RAZZLE_ES_PROXY_ADDR || 'http://localhost:3000',
76
+ };
70
77
  if (typeof window !== 'undefined') {
71
78
  config.searchui.globalsearch.host =
72
79
  process.env.RAZZLE_ES_PROXY_ADDR || getClientProxyAddress();
@@ -201,7 +201,7 @@ export default {
201
201
  },
202
202
  {
203
203
  id: 'website',
204
- title: 'Sources',
204
+ title: 'Websites',
205
205
  facetField: 'cluster_name',
206
206
  sortOn: 'count',
207
207
  sortOrder: 'desc',
package/src/index.js CHANGED
@@ -3,11 +3,14 @@ import installGlobalsearch from './config';
3
3
  export default (config) => {
4
4
  config.settings.searchlib = installGlobalsearch(config.settings.searchlib);
5
5
 
6
- const { globalsearch } = config.settings.searchlib.searchui;
6
+ const { globalsearch, globalsearchbase } = config.settings.searchlib.searchui;
7
7
 
8
8
  // Tweak the searchlib config to use the middleware instead of the index
9
9
  globalsearch.elastic_index = '_es/globalsearch';
10
10
  globalsearch.index_name = 'data_searchui';
11
11
 
12
+ globalsearchbase.elastic_index = '_es/globalsearch';
13
+ globalsearchbase.index_name = 'data_searchui';
14
+
12
15
  return config;
13
16
  };
package/src/utils.js CHANGED
@@ -5,7 +5,7 @@
5
5
  // });
6
6
  // return icons;
7
7
  // };
8
- //
8
+
9
9
  export const build_runtime_mappings = (settings) => {
10
10
  const clusters = settings.clusters
11
11
  .map((cluster) => {
@@ -62,6 +62,7 @@ export function getTodayWithTime() {
62
62
  ].join('');
63
63
  return output;
64
64
  }
65
+
65
66
  export const getGlobalsearchIconUrl = (contentTypeNormalize) => (
66
67
  result,
67
68
  config,