Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion modules/invenio-oaiserver/invenio_oaiserver/percolator.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,9 @@ def get_record_sets(record):
yield spec

# get list of sets that match using percolator
index, doc_type = RecordIndexer().record_to_index(record)
document = record.dumps()
document.pop('$schema', None)
index, doc_type = RecordIndexer().record_to_index(document)

percolator_doc_type = _get_percolator_doc_type(index)
_create_percolator_mapping(index, percolator_doc_type)
Expand Down
9 changes: 4 additions & 5 deletions modules/weko-deposit/weko_deposit/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1595,21 +1595,20 @@ def delete_by_index_tree_id(cls, index_id: str, ignore_items: list = []):
"""
if index_id:
index_id = str(index_id)
obj_ids = next((cls.indexer.get_pid_by_es_scroll(index_id, only_latest_version=True)), [])
removed_records = []
obj_ids = next((cls.indexer.get_pid_by_es_scroll(index_id)), [])
for obj_uuid in obj_ids:
r = RecordMetadata.query.filter_by(id=obj_uuid).first()
if r.json['recid'] in ignore_items:
continue
r.json['path'].remove(index_id)
if index_id in r.json.get('_oai', {}).get('sets', []):
r.json['_oai']['sets'].remove(index_id)
flag_modified(r, 'json')
if r.json and not r.json['path']:
from weko_records_ui.utils import soft_delete
soft_delete(obj_uuid)
removed_records.append(r)
for r in removed_records:
dep = WekoDeposit(r.json, r)
dep.indexer.update_es_data(dep, update_revision=False)
dep.indexer.update_es_data(dep, update_revision=False, update_oai=True)

def update_pid_by_index_tree_id(self, path):
"""
Expand Down
Loading