@@ -32,8 +32,7 @@ def fetch_current_indexed_packages(es : Elasticsearch, index_name):
32
32
continue
33
33
if '_type' in eachHit :
34
34
if '_doc' == eachHit ['_type' ]:
35
- if False == eachHit ['_source' ]['hidden' ]:
36
- all_packages .append (eachHit ['_source' ])
35
+ all_packages .append (eachHit ['_source' ])
37
36
38
37
# Sort all_packages alphabetically by the 'name' field
39
38
all_packages .sort (key = lambda x : x ['name' ])
@@ -95,6 +94,10 @@ def str2bool(v):
95
94
data = json .load (file )
96
95
97
96
update_data = ''
97
+ # By default hide all packages that are being reindexed.
98
+ # If the index request was for today's date - script will make all
99
+ # requested packages visible in NECTO.
100
+ hide_package = True
98
101
99
102
print ('# Reindex request has been triggered! You can rest while I do your job!' )
100
103
@@ -104,6 +107,7 @@ def str2bool(v):
104
107
if event ['end_dt' ].startswith (date_to_update ) and event ['released' ]:
105
108
update_data += event ['notes' ].replace ('Clock for ' , '' )
106
109
print (update_data .replace ('<li>' , '- ' ).replace ('<ul>' , '' ).replace ('</ul>' , '' ).replace ('</li>' , '' ))
110
+ hide_package = False
107
111
else :
108
112
print (f'## Packages that were requested to be indexed with { args .date } :' )
109
113
update_data = '- '
@@ -120,6 +124,7 @@ def str2bool(v):
120
124
if package ['display_name' ] in update_data :
121
125
package ['published_at' ] = f'{ date_to_update } T06:00:00Z'
122
126
package ['package_changed' ] = True
127
+ package ['hidden' ] = hide_package
123
128
if 'show_package_info' in package :
124
129
package ['show_package_info' ] = True
125
130
# Kibana v8 requires _type to be in body in order to have doc_type defined
0 commit comments