Skip to content

Commit

Permalink
handle deletion in sharev2_elastic formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
aaxelb committed Jan 12, 2021
1 parent 816b573 commit 79e8a2e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion share/metadata_formats/sharev2_elastic.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,16 @@ def format(self, normalized_datum):
return None

suid = normalized_datum.raw.suid
source_name = suid.source_config.source.long_title

# a document with is_deleted:True will be deleted from the elastic index
# TODO handle deletion better -- maybe put a `deleted` field on suids and actually delete the FormattedMetadataRecord
if central_work['is_deleted']:
return json.dumps({
'id': suid.id,
'is_deleted': True,
})

source_name = suid.source_config.source.long_title
return json.dumps({
'id': suid.id,
'sources': [source_name],
Expand Down

0 comments on commit 79e8a2e

Please sign in to comment.