Skip to main content

InvenioRDM module for a Global Search

Project description

https://github.com/tu-graz-library/invenio-global-search/workflows/CI/badge.svg https://img.shields.io/github/tag/tu-graz-library/invenio-global-search.svg https://img.shields.io/pypi/dm/invenio-global-search.svg https://img.shields.io/github/license/tu-graz-library/invenio-global-search.svg

Dublin Core data model for InvenioRDM

Tests

uv run ./run-tests.sh

Installation

This basic installation of this package:

uv pip install invenio-global-search

will not give access to any of its features. It is intended to be extended with the packages needed in a specific Invenio instance.

There are 3 packages handled by invenio-global-search:

  • rdm-records

  • lom (OER)

  • marc21 (Publications)

To install any of them or all:

  • uv pip install invenio-global-search[rdm]

    This enables the rdm-records features.

  • uv pip install invenio-global-search[rdm, marc21, lom]

    This enables all the features of the package.

Configuration

Add the following code blocks to the invenio.cfg file.

Components

If all packages mentioned above are installed, simply add:

from invenio_rdm_records.services.components import DefaultRecordsComponents
from invenio_global_search.components import (
    LOMToGlobalSearchComponent,
    Marc21ToGlobalSearchComponent,
    RDMToGlobalSearchComponent,
)

from invenio_rdm_records.services.components import (
    DefaultRecordsComponents as RDMDefaultRecordsComponents,
)
from invenio_records_lom.services.components import (
    DefaultRecordsComponents as LOMDefaultRecordsComponents,
)
from invenio_records_marc21.services.components import (
    DefaultRecordsComponents as Marc21DefaultRecordsComponents,
)


RDM_RECORDS_SERVICE_COMPONENTS = RDMDefaultRecordsComponents + [
    RDMToGlobalSearchComponent
]
LOM_RECORDS_SERVICE_COMPONENTS = LOMDefaultRecordsComponents + [
    LOMToGlobalSearchComponent
]
MARC21_RECORDS_SERVICE_COMPONENTS = Marc21DefaultRecordsComponents + [
    Marc21ToGlobalSearchComponent
]

If there is a chance that one of them is not installed, this can be handled with try-except:

try:
    from invenio_records_marc21.services.components import (
        DefaultRecordsComponents as Marc21DefaultRecordsComponents,
    )
except ImportError:
    Marc21DefaultRecordsComponents = None

if Marc21DefaultRecordsComponents is not None:
    MARC21_RECORDS_SERVICE_COMPONENTS = Marc21DefaultRecordsComponents + [
        Marc21ToGlobalSearchComponent
    ]
else:
    MARC21_RECORDS_SERVICE_COMPONENTS = [Marc21ToGlobalSearchComponent]

Search template

SEARCH_UI_SEARCH_TEMPLATE = "invenio_records_dublin_core/search/search.html"

from invenio_search_ui.views import blueprint
from flask import render_template

@blueprint.route("/records/search")
def records_search():
    """Search page ui."""
    return render_template("invenio_app_rdm/records/search.html")

Schema

As mentioned for components, if all packages are installed, add:

GLOBAL_SEARCH_ORIGINAL_SCHEMAS = {
    "lom": {
        "schema": "lom",
        "name_l10n": _("OER"),
    },
    "rdm": {
        "schema": "rdm",
        "name_l10n": _("Research Result"),
    },
    "marc21": {
        "schema": "marc21",
        "name_l10n": _("Publication"),
    },
}

If one or more is missing, simply remove the entry for the respective package.

OpenAIRE Indexing

ListRecords & GetRecord features

An InvenioRDM repository can be harvested via the Open Archives Initiative Protocol for Metadata Harvesting (OAI-PMH). OAI-PMH is a widely used protocol for harvesting metadata and most popular repository software provide support for this protocol.

Because Global search needs to support multiple data models, the default OAISERVER_ features had to be overridden with custom function and classes that are based mostly on global-search index. This works also because global-search keeps track only of open-access records.

Currently supported custom OAI Features:
  • ListRecords and GetRecord for

    • metadataPrefix = oai_dc -> records from all 3 data models are serialized

    • metadataPrefix = lom -> only OER records are serialized

    • metadataPrefix = marc21 -> only Publication records are serialized

Access these by searching for the endpoint /oai2d and adding params like ?verb=ListRecords. Examples:

  • https://yourinvenio.com/oai2d?verb=ListRecords&metadataPrefix=marc21

  • https://yourinvenio.com/oai2d?verb=GetRecord&identifier=oai:yourinvenio.com:46t12-eng12&metadataPrefix=marc21

Sets

TODO

Further documentation is available on https://invenio-global-search.readthedocs.io/

Changes

Version v0.4.3 (released 2026-05-21)

  • fix(oai): lom allows per defintion only lom

Version v0.4.2 (released 2026-05-18)

  • fix: code block for changes.rst

Version v0.4.1 (released 2026-05-18)

  • fix(docs): include word containing ‘_’ in code block

Version v0.4.0 (released 2026-05-18)

  • chore(docs): move to uv

  • fix(docs): keep only README.rst

  • chore(oai): add OAI docs

  • feat(oai): move not implemented sets fetcher to GS

  • tests: py 3.14

  • tests: add ruff check

  • fix: type errors

  • feat(oai): add necessary functions for OAISERVER_ overrides

Version v0.3.0 (release 2025-05-15)

  • refactor: heavy refactoring

  • tests: just python 3.12

  • chore: multiple small changes

  • docs: update README

  • dependencies: handle libraries just if installed

Version v0.2.5 (release 2025-01-24)

  • setup: only because of dev deps

  • setup: remove restrictions on dependencies

  • setup: update ruff/mypy configuration

  • refactor: remove None defaults

Version v0.2.4 (release 2024-06-13)

  • fix: catch validation error this ensures that rebuilding the database does not exit on the first error

  • setup: support only python3.12

Version v0.2.3 (release 2024-02-12)

  • fix: update changed lom api

Version v0.2.2 (release 2024-01-12)

  • fix: permission problem

Version v0.2.1 (release 2024-01-07)

  • fix: rebuild all databases

Version v0.2.0 (release 2023-11-23)

  • global: rename components

Version v0.1.0 (release 2023-11-10)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

invenio_global_search-0.4.3.tar.gz (17.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

invenio_global_search-0.4.3-py2.py3-none-any.whl (15.2 kB view details)

Uploaded Python 2Python 3

File details

Details for the file invenio_global_search-0.4.3.tar.gz.

File metadata

  • Download URL: invenio_global_search-0.4.3.tar.gz
  • Upload date:
  • Size: 17.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for invenio_global_search-0.4.3.tar.gz
Algorithm Hash digest
SHA256 cad95d144baa2f1dbde9b2538c32cce755005b5d6cc52db5d27037c086b09aef
MD5 e5c3cc439329439d2f840953c6c38acb
BLAKE2b-256 7ff8581cb63fdd02694cd74d6a12d8795a0e26d26982f17cacd75cfd8e4b1f29

See more details on using hashes here.

File details

Details for the file invenio_global_search-0.4.3-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for invenio_global_search-0.4.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 f579e549101bde7e2d9bf27ae501a6b2428bdb3b43da0db68482f33c6b8e3e76
MD5 c5069c586d016ad5ad574c08f91aeb43
BLAKE2b-256 c1621c178b2ff37586b26fbc09896e48a04056d054a0a02176639da647ab8fa1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page