Skip to content
New issue

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

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

Already on GitHub? # to your account

indexer: better code #87

Merged
merged 1 commit into from
Aug 2, 2022
Merged
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
12 changes: 9 additions & 3 deletions rero_mef/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,9 +407,15 @@ def _get_indexer_class(self, payload):
"""Get the record class from payload."""
# take the first defined doc type for finding the class
pid_type = payload.get('doc_type', 'rec')
endpoints = current_app.config.get('RECORDS_REST_ENDPOINTS')
return obj_or_import_string(
endpoints.get(pid_type).get('indexer_class', RecordIndexer))
try:
indexer = obj_or_import_string(
current_app.config[
'RECORDS_REST_ENDPOINTS'][pid_type]['indexer_class']
)
except Exception:
# provide default indexer if no indexer is defined in config.
indexer = ReroIndexer
return indexer

def process_bulk_queue(self, es_bulk_kwargs=None, stats_only=True):
"""Process bulk indexing queue.
Expand Down
Loading