Skip to content

Fix how the RECORDS_REST... config is injected in search template #80

@ntarocco

Description

@ntarocco

format_config macro in views.py

The configuration of the endpoint URL /api/records and the facets/sort options is now taken from the RECORDS_REST_ENDPOINTS config, search_index field. See Jinja macro:

@blueprint.app_template_filter("format_config")
def format_config(config, endpoint_name):
    """Create config JSON dump for Invenio-Search-JS with React-SearchKit."""
    search_index = (
        config.get("RECORDS_REST_ENDPOINTS", {})
        .get(endpoint_name, {})
        .get("search_index", "records")
    )
    facets = dict(aggs=dict(type=dict(terms=dict(field="type"))))

The issue is that in the records-rest, the search_index field might not be defined (automatically retrieved from the search class).

The second issue is that facets works only with terms, the config parsing should changed or enhanced.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions