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

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

Open
ntarocco opened this issue May 14, 2020 · 0 comments
Open

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

ntarocco opened this issue May 14, 2020 · 0 comments

Comments

@ntarocco
Copy link
Contributor

ntarocco commented May 14, 2020

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.

@ntarocco ntarocco changed the title Get seach-index from endpoint_name config Get search_index from RECORDS_REST_ENDPOINTS config May 14, 2020
@ntarocco ntarocco changed the title Get search_index from RECORDS_REST_ENDPOINTS config Fix how the RECORDS_REST... config is injected in search template May 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant