Skip to content

Commit fbb5d06

Browse files
committed
fix: use index to distinguish type
* the problem with is_published is that drafts created from records will not be recogniced correctly * using the index is a valid solution but it is not a nice implementation.
1 parent 2aeace1 commit fbb5d06

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

invenio_rdm_records/services/results.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#
33
# Copyright (C) 2022 CERN.
44
# Copyright (C) 2023 TU Wien.
5+
# Copyright (C) 2024 Graz University of Technology.
56
#
67
# Invenio-RDM-Records is free software; you can redistribute it and/or modify
78
# it under the terms of the MIT License; see LICENSE file for more details.
@@ -83,7 +84,9 @@ def hits(self):
8384
for hit in self._results:
8485
# Load dump
8586
record_dict = hit.to_dict()
86-
if record_dict["is_published"]:
87+
88+
index_name = self._service.record_cls.index._name
89+
if index_name in hit.meta["index"]:
8790
record = self._service.record_cls.loads(record_dict)
8891
else:
8992
record = self._service.draft_cls.loads(record_dict)

0 commit comments

Comments
 (0)