@@ -40,6 +40,8 @@ def runProcess(self):
40
40
self .cluster_records (full = True )
41
41
elif self .process == 'custom' :
42
42
self .cluster_records (start_datetime = self .ingestPeriod )
43
+ elif self .process == 'single' :
44
+ self .cluster_records (record_uuid = self .singleRecord )
43
45
else :
44
46
logger .warning (f'Unknown cluster process type { self .process } ' )
45
47
except Exception as e :
@@ -48,7 +50,7 @@ def runProcess(self):
48
50
finally :
49
51
self .close_connection ()
50
52
51
- def cluster_records (self , full = False , start_datetime = None ):
53
+ def cluster_records (self , full = False , start_datetime = None , record_uuid = None ):
52
54
get_unclustered_records_query = (
53
55
self .session .query (Record )
54
56
.filter (Record .frbr_status == 'complete' )
@@ -65,6 +67,9 @@ def cluster_records(self, full=False, start_datetime=None):
65
67
66
68
get_unclustered_records_query = get_unclustered_records_query .filter (Record .date_modified > start_datetime )
67
69
70
+ if record_uuid :
71
+ get_unclustered_records_query = get_unclustered_records_query .filter (Record .uuid == record_uuid )
72
+
68
73
works_to_index = []
69
74
work_ids_to_delete = set ()
70
75
@@ -167,6 +172,11 @@ def find_all_matching_records(self, record: Record):
167
172
168
173
for matched_record in matched_records :
169
174
matched_record_title , matched_record_id , matched_record_identifiers = matched_record
175
+
176
+ if not matched_record_title :
177
+ logger .warning (f'Matched record with id { matched_record_id } has no title' )
178
+ continue
179
+
170
180
tokenized_matched_record_title = self .tokenize_title (matched_record_title )
171
181
172
182
if match_distance > 0 and not self .titles_overlap (tokenized_record_title , tokenized_matched_record_title ):
0 commit comments