Skip to content

Commit

Permalink
release: v4.36.3
Browse files Browse the repository at this point in the history
  • Loading branch information
zzacharo committed Oct 15, 2023
1 parent 6557ca3 commit 7663107
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 9 deletions.
4 changes: 4 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
Changes
=======

Version 4.36.3 (2023-10-15)

- fix search of drafts

Version 4.36.2 (2023-10-14)

- datastore: prevent autoflush on search
Expand Down
2 changes: 1 addition & 1 deletion invenio_rdm_records/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@

from .ext import InvenioRDMRecords

__version__ = "4.36.2"
__version__ = "4.36.3"

__all__ = ("__version__", "InvenioRDMRecords")
28 changes: 20 additions & 8 deletions invenio_rdm_records/services/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,14 +402,26 @@ def search_drafts(
#
# To filter out deleted records we apply the following logic:
# deletion_status=="P" or "deletion_status" not in data

search_filter = dsl.query.Q("bool", should=[
dsl.query.Q("bool", must=[dsl.query.Q("term", deletion_status=RecordDeletionStatusEnum.PUBLISHED.value)]),
# Drafts does not have deletion_status so this clause is needed to
# prevent the above clause from filtering out the drafts
# TODO: ensure draft also has the needed data.
dsl.query.Q("bool", must_not=[dsl.query.Q("exists", field="deletion_status")]),
])
search_filter = dsl.query.Q(
"bool",
should=[
dsl.query.Q(
"bool",
must=[
dsl.query.Q(
"term",
deletion_status=RecordDeletionStatusEnum.PUBLISHED.value,
)
],
),
# Drafts does not have deletion_status so this clause is needed to
# prevent the above clause from filtering out the drafts
# TODO: ensure draft also has the needed data.
dsl.query.Q(
"bool", must_not=[dsl.query.Q("exists", field="deletion_status")]
),
],
)
if extra_filter:
search_filter &= extra_filter
return super().search_drafts(
Expand Down

0 comments on commit 7663107

Please sign in to comment.