Skip to content

Commit 3bf3f3a

Browse files
committed
Fix for organization and foundational filtering in 2.1.1
1 parent 4333226 commit 3bf3f3a

File tree

4 files changed

+12
-14
lines changed

4 files changed

+12
-14
lines changed

deployment/lambda-search/app.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,7 @@ def lambda_handler(event, context):
404404
type_filter = event.get('type', None)
405405
protocol_filter = event.get('protocol', None)
406406
mappable_filter = event.get('mappable', None)
407+
foundational_filter = event.get('foundational', None)
407408
eoCollection_filter = event.get('eo_collection', None)
408409
polarization_filter = event.get('polarization', None)
409410
orbit_direction_filter = event.get('orbit_direction', None)
@@ -443,6 +444,9 @@ def lambda_handler(event, context):
443444
if mappable_filter:
444445
mappable_field = filter_config["mappable"] # Get field paths from config
445446
filters.append(build_wildcard_filter(mappable_field, mappable_filter))
447+
if foundational_filter:
448+
foundational_field = filter_config["foundational"] # Get field paths from config
449+
filters.append(build_wildcard_filter(foundational_field, foundational_filter))
446450
if eoCollection_filter:
447451
eo_collection_field = filter_config["eo_collection"] # Get field paths from config
448452
filters.append(build_wildcard_filter(eo_collection_field, eoCollection_filter))
@@ -476,20 +480,18 @@ def lambda_handler(event, context):
476480
# If no filters are specified, set filters to None
477481
filters = filters if filters else None
478482

479-
print("filters : ", filters)
483+
#print("filters : ", filters)
480484

481485
####
482486
#OpenSearch DashBoard code
483487
####
484488
ip_address = event.get('ip_address', '') or ''
489+
#print("ip_address", ip_address)
485490
ip_address_forward = event.get('ip_address_forward', '') or ''
486-
print("ip_address_forward", ip_address_forward)
487-
491+
#print("ip_address_forward", ip_address_forward)
488492
if ip_address_forward:
489-
ip_address = ip_address_forward.split(',')[0].strip() #Use first forwarded IP address if it exists
490-
491-
print("ip_address", ip_address)
492-
493+
ip_address = ip_address_forward.split(',')[0].strip() #Use first forwarded IP address if it exists
494+
#print("final ip", ip_address)
493495
timestamp = event.get('timestamp', '') or ''
494496
user_agent = event.get('user_agent', '') or ''
495497
http_method = event.get('http_method', '') or ''

deployment/lambda-search/dashboard.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ def create_opensearch_index(os_client, index_name):
5252
"lang": {"type": "keyword"},
5353
"id": {"type": "keyword"},
5454
"q": {"type": "keyword"},
55-
"ip_address": {"type": "ip"},
5655
"user_agent": {"type": "keyword"},
5756
"http_method": {"type": "keyword"},
5857
"sort_param": {"type": "keyword"},

deployment/lambda-search/filter_builder.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ def build_wildcard_filter(field_paths, values):
2626
for field_path in field_paths
2727
]
2828

29-
print(should_clauses)
30-
3129
return {
3230
"bool": {
3331
"should": should_clauses,

deployment/lambda-search/filter_config.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,11 @@
1212
"topicCategory.keyword"
1313
],
1414
"org": [
15-
"contact.organisation.en.keyword",
16-
"contact.organisation.fr.keyword"
15+
"organisation.en.keyword",
16+
"organisation.fr.keyword"
1717
],
1818
"foundational": [
19-
"contact.keywords.en.keyword",
20-
"contact.keywords.fr.keyword"
19+
"foundational.keyword"
2120
],
2221
"source_system": [
2322
"systemName.keyword"

0 commit comments

Comments
 (0)