Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config: make OAI-PMH record index dynamic #2832

Merged
merged 1 commit into from
Sep 11, 2024
Merged
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
11 changes: 9 additions & 2 deletions invenio_app_rdm/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
UserAccessRequestDeclineNotificationBuilder,
UserAccessRequestSubmitNotificationBuilder,
)
from invenio_rdm_records.proxies import current_rdm_records_service
from invenio_rdm_records.requests.entity_resolvers import (
EmailResolver,
RDMRecordServiceResultResolver,
Expand Down Expand Up @@ -155,6 +156,7 @@
from invenio_vocabularies.contrib.subjects.datastreams import (
VOCABULARIES_DATASTREAM_WRITERS as SUBJECTS_WRITERS,
)
from werkzeug.local import LocalProxy

from .theme.views import notification_settings
from .users.schemas import NotificationsUserSchema, UserPreferencesNotificationsSchema
Expand Down Expand Up @@ -651,7 +653,10 @@ def files_rest_permission_factory(obj, action):
OAISERVER_RECORD_SETS_FETCHER = "invenio_oaiserver.percolator:find_sets_for_record"
"""Record's OAI sets function."""

OAISERVER_RECORD_INDEX = "rdmrecords-records"
OAISERVER_RECORD_INDEX = LocalProxy(
lambda: current_rdm_records_service.record_cls.index._name
)

"""Specify a search index with records that should be exposed via OAI-PMH."""

OAISERVER_GETRECORD_FETCHER = "invenio_rdm_records.oai:getrecord_fetcher"
Expand Down Expand Up @@ -694,7 +699,9 @@ def files_rest_permission_factory(obj, action):
# ===============
# See https://invenio-indexer.readthedocs.io/en/latest/configuration.html

INDEXER_DEFAULT_INDEX = "rdmrecords-records-record-v7.0.0"
# We want that indexers are always explicit about the index they are indexing to.
# NOTE: Can be removed when https://github.com/inveniosoftware/invenio-indexer/pull/158 is merged and released.
INDEXER_DEFAULT_INDEX = None
slint marked this conversation as resolved.
Show resolved Hide resolved
"""Default index to use if no schema is defined."""

# Invenio-Base
Expand Down
Loading