Skip to content

Commit 0e25ee3

Browse files
author
Magnar Eivind Martinsen
committed
Updated metsis search configuration to allow for cloud coverage filter in the elements search view. Add 5min caching for the elements search view
1 parent 419a150 commit 0e25ee3

File tree

2 files changed

+149
-4
lines changed

2 files changed

+149
-4
lines changed

metsis/metsis_search/config/install/views.view.metsis_elements.yml

+127-2
Original file line numberDiff line numberDiff line change
@@ -2482,6 +2482,120 @@ display:
24822482
default_group: All
24832483
default_group_multiple: { }
24842484
group_items: { }
2485+
platform_ancillary_cloud_coverage:
2486+
id: platform_ancillary_cloud_coverage
2487+
table: search_api_index_metsis
2488+
field: platform_ancillary_cloud_coverage
2489+
relationship: none
2490+
group_type: group
2491+
admin_label: 'cloud coverage'
2492+
plugin_id: search_api_numeric
2493+
operator: '='
2494+
value:
2495+
min: ''
2496+
max: ''
2497+
value: ''
2498+
group: 1
2499+
exposed: true
2500+
expose:
2501+
operator_id: platform_ancillary_cloud_coverage_op
2502+
label: 'Platform ancillary cloud coverage'
2503+
description: null
2504+
use_operator: false
2505+
operator: platform_ancillary_cloud_coverage_op
2506+
operator_limit_selection: false
2507+
operator_list: { }
2508+
identifier: platform_ancillary_cloud_coverage
2509+
required: false
2510+
remember: false
2511+
multiple: false
2512+
remember_roles:
2513+
authenticated: authenticated
2514+
min_placeholder: null
2515+
max_placeholder: null
2516+
placeholder: null
2517+
is_grouped: true
2518+
group_info:
2519+
label: 'Cloud Coverage'
2520+
description: 'Filter on cloud coverage for products (Applies only to Sentinel products)'
2521+
identifier: platform_ancillary_cloud_coverage
2522+
optional: true
2523+
widget: select
2524+
multiple: false
2525+
remember: false
2526+
default_group: All
2527+
default_group_multiple: { }
2528+
group_items:
2529+
1:
2530+
title: '<10%'
2531+
operator: '<'
2532+
value:
2533+
min: ''
2534+
max: ''
2535+
value: '10.0'
2536+
2:
2537+
title: '<20%'
2538+
operator: '<'
2539+
value:
2540+
min: ''
2541+
max: ''
2542+
value: '20.0'
2543+
3:
2544+
title: '<30%'
2545+
operator: '<'
2546+
value:
2547+
min: ''
2548+
max: ''
2549+
value: '30.0'
2550+
4:
2551+
title: '<40%'
2552+
operator: '<'
2553+
value:
2554+
min: ''
2555+
max: ''
2556+
value: '40.0'
2557+
5:
2558+
title: '<50%'
2559+
operator: '<'
2560+
value:
2561+
min: ''
2562+
max: ''
2563+
value: '50.0'
2564+
6:
2565+
title: '<60%'
2566+
operator: '<'
2567+
value:
2568+
min: ''
2569+
max: ''
2570+
value: '60.0'
2571+
7:
2572+
title: '<70%'
2573+
operator: '<'
2574+
value:
2575+
min: ''
2576+
max: ''
2577+
value: '70.0'
2578+
8:
2579+
title: '<80%'
2580+
operator: '<'
2581+
value:
2582+
min: ''
2583+
max: ''
2584+
value: '80.0'
2585+
9:
2586+
title: '<90%'
2587+
operator: '<'
2588+
value:
2589+
min: ''
2590+
max: ''
2591+
value: '90.0'
2592+
10:
2593+
title: '<100%'
2594+
operator: '<'
2595+
value:
2596+
min: ''
2597+
max: ''
2598+
value: '100.0'
24852599
filter_groups:
24862600
operator: AND
24872601
groups:
@@ -2586,7 +2700,12 @@ display:
25862700
position: 1
25872701
display_options:
25882702
cache:
2589-
type: search_api_none
2703+
type: search_api_time
2704+
options:
2705+
results_lifespan: 300
2706+
results_lifespan_custom: 0
2707+
output_lifespan: 300
2708+
output_lifespan_custom: 0
25902709
defaults:
25912710
cache: false
25922711
exposed_block: true
@@ -2610,12 +2729,18 @@ display:
26102729
parent: ''
26112730
context: '0'
26122731
cache_metadata:
2613-
max-age: -1
2732+
max-age: 0
26142733
contexts:
26152734
- 'languages:language_interface'
26162735
- url
26172736
- url.query_args
26182737
- user.roles
26192738
tags:
2739+
- 'config:facets.facet.elements_end_date'
2740+
- 'config:facets.facet.elements_start_date_day'
2741+
- 'config:facets.facet.elements_start_date_month'
2742+
- 'config:facets.facet.elements_start_date_year'
2743+
- 'config:facets.facet.keywords_elements'
26202744
- 'config:search_api.index.metsis'
2745+
- 'config:views.view.metsis_elements'
26212746
- 'search_api_list:metsis'

metsis/metsis_search/src/Form/MetsisSearchConfigurationForm.php

+22-2
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,12 @@ public function buildForm(array $form, FormStateInterface $form_state) {
109109
// Add cloud coverage filter.
110110
$form['enable_cloud_coverage'] = [
111111
'#type' => 'checkbox',
112-
'#title' => 'Enable cloud coverage search filter in search form',
112+
'#title' => 'Enable cloud coverage search filter in main search form',
113113
'#default_value' => $config->get('enable_cloud_coverage'),
114114
];
115115
$form['cloud_coverage_details'] = [
116116
'#type' => 'checkbox',
117-
'#title' => $this->t('Show the cloud coverage filter inside a closed details tag in search form'),
117+
'#title' => $this->t('Show the cloud coverage filter inside a closed details tag in the main search form'),
118118
'#size' => 15,
119119
'#default_value' => $config->get('cloud_coverage_details'),
120120
'#states' => [
@@ -124,6 +124,24 @@ public function buildForm(array $form, FormStateInterface $form_state) {
124124
],
125125
];
126126

127+
// Add cloud coverage filter.
128+
$form['enable_cloud_coverage_elements'] = [
129+
'#type' => 'checkbox',
130+
'#title' => 'Enable cloud coverage search filter in elements search form',
131+
'#default_value' => $config->get('enable_cloud_coverage_elements'),
132+
];
133+
$form['cloud_coverage_details_elements'] = [
134+
'#type' => 'checkbox',
135+
'#title' => $this->t('Show the cloud coverage filter inside a closed details tag in the elements search form'),
136+
'#size' => 15,
137+
'#default_value' => $config->get('cloud_coverage_details_elements'),
138+
'#states' => [
139+
'visible' => [
140+
':input[name="enable_cloud_coverage_elements"]' => ['checked' => TRUE],
141+
],
142+
],
143+
];
144+
127145
// Add cloud coverage filter.
128146
$form['bbox_overlap_sort'] = [
129147
'#type' => 'checkbox',
@@ -327,6 +345,8 @@ public function submitForm(array &$form, FormStateInterface $form_state): void {
327345
->set('enable_cloud_coverage', $values['enable_cloud_coverage'])
328346
->set('cloud_coverage_details', $values['cloud_coverage_details'])
329347
->set('disable_children_filter', $values['disable_children_filter'])
348+
->set('cloud_coverage_details_elements', $values['cloud_coverage_details_elements'])
349+
->set('disable_children_filter_elements', $values['disable_children_filter_elements'])
330350
->set('bbox_overlap_sort', $values['bbox_overlap_sort'])
331351
->set('search_match_children', $values['search_match_children'])
332352
->save();

0 commit comments

Comments
 (0)