esgf-pyclient icon indicating copy to clipboard operation
esgf-pyclient copied to clipboard

Facets warning with aggregation_context(): unexpected keyword

Open TerpstraS opened this issue 1 year ago • 0 comments

Hello,

According to the documentation, we always need to supply facets to the search_context(). If not, we get the following warning:

Warning - defaulting to search with facets=*

This behavior is kept for backward-compatibility, but ESGF indexes might not
successfully perform a distributed search when this option is used, so some
results may be missing.  For full results, it is recommended to pass a list of
facets of interest when instantiating a context object.  For example,

      ctx = conn.new_context(facets='project,experiment_id')

Only the facets that you specify will be present in the facets_counts dictionary.

This warning is displayed when a distributed search is performed while using the
facets=* default, a maximum of once per context object.  To suppress this warning,
set the environment variable ESGF_PYCLIENT_NO_FACETS_STAR_WARNING to any value
or explicitly use  conn.new_context(facets='*')

-------------------------------------------------------------------------------

However, the problem is that this warning also appears for aggregation_context(), even though aggregation_context() does not take facets as parameter. Even if I create a new_context() with facets and then create an aggregation_context() out of the ctx.search(), I get the facets warning. (For example with this piece of code:

facets = "source_id"
ctx = conn.new_context(
    project='CMIP6',
    experiment_id="historical",
    facets=facets
)
result = ctx.search()[0]
agg_ctx = result.aggregation_context().search()

).

Is this a problem? Will this lead to an incomplete distributed search or is it something I do not need to worry about?

Thank you in advance!

TerpstraS avatar Oct 10 '22 07:10 TerpstraS