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

ignore_facet_check search option appears to be broken #75

Closed
bouweandela opened this issue Aug 9, 2021 · 0 comments · Fixed by #76
Closed

ignore_facet_check search option appears to be broken #75

bouweandela opened this issue Aug 9, 2021 · 0 comments · Fixed by #76

Comments

@bouweandela
Copy link
Collaborator

When I run this script:

import logging

import pyesgf.search


def example():
    logging.basicConfig(format="%(asctime)s [%(process)d] %(levelname)-8s "
                        "%(name)s,%(lineno)s\t%(message)s")
    pyesgf.search.connection.log.setLevel(logging.DEBUG)
    conn = pyesgf.search.SearchConnection(
        url='http://esgf-node.llnl.gov/esg-search')
    ctx = conn.new_context(project='CMIP5')
    ctx.search(ignore_facet_check=True)


if __name__ == '__main__':
    example()

the code crashes with the following output:

DEBUG:pyesgf.search.connection:Query dict is MultiDict([('format', 'application/solr+json'), ('limit', 0), ('distrib', 'true'), ('type', 'Dataset'), ('project', 'CMIP5')])
DEBUG:pyesgf.search.connection:Query request is http://esgf-node.llnl.gov/esg-search/search?format=application%2Fsolr%2Bjson&limit=0&distrib=true&type=Dataset&project=CMIP5
Traceback (most recent call last):
  File "/home/bandela/src/esmvalgroup/esmvalcore/try_filesearch.py", line 96, in <module>
    example()
  File "/home/bandela/src/esmvalgroup/esmvalcore/try_filesearch.py", line 92, in example
    ctx.search(ignore_facet_check=True)
  File "/home/bandela/conda/envs/esmvaltool/lib/python3.9/site-packages/pyesgf/search/context.py", line 126, in search
    sc.__update_counts(ignore_facet_check=ignore_facet_check)
  File "/home/bandela/conda/envs/esmvaltool/lib/python3.9/site-packages/pyesgf/search/context.py", line 207, in __update_counts
    for facet, counts in (list(response['facet_counts']['facet_fields'].items())):
KeyError: 'facet_counts'
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

Successfully merging a pull request may close this issue.

1 participant