diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2020-07-23 16:10:40 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2020-07-24 10:07:48 -0700 |
commit | 7010abf54fae6a04f4a0700651e64a1fe5b5b2c8 (patch) | |
tree | 5053f9790f5adbab75c010bed988fe3c09838785 | |
parent | d798ee172294de09ab1621530df4e3498a17640e (diff) | |
download | fatcat-7010abf54fae6a04f4a0700651e64a1fe5b5b2c8.tar.gz fatcat-7010abf54fae6a04f4a0700651e64a1fe5b5b2c8.zip |
re-order search params to satisfy pylint
Moved all the request_cache=True param calls to just before ES request
exectuation. The former ordering "just worked", but pylint didn't like
it, and I suspose it was not as idiomatic as it should have been.
-rw-r--r-- | python/fatcat_web/search.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/python/fatcat_web/search.py b/python/fatcat_web/search.py index 1165a004..55caa9c5 100644 --- a/python/fatcat_web/search.py +++ b/python/fatcat_web/search.py @@ -246,9 +246,9 @@ def get_elastic_container_random_releases(ident, limit=5): ] ) search = search.sort('-in_web', '-release_date') - search = search.params(request_cache=True) search = search[:int(limit)] + search = search.params(request_cache=True) resp = wrap_es_execution(search) results = results_to_dict(resp) @@ -268,7 +268,6 @@ def get_elastic_entity_stats(): # release totals search = Search(using=app.es_client, index=app.config['ELASTICSEARCH_RELEASE_INDEX']) - search = search.params(request_cache=True) search.aggs.bucket( 'release_ref_count', 'sum', @@ -276,6 +275,7 @@ def get_elastic_entity_stats(): ) search = search[:0] # pylint: disable=unsubscriptable-object + search = search.params(request_cache=True) resp = wrap_es_execution(search) stats['release'] = { @@ -294,7 +294,6 @@ def get_elastic_entity_stats(): # "thesis", ], ) - search = search.params(request_cache=True) search.aggs.bucket( 'paper_like', 'filters', @@ -310,6 +309,7 @@ def get_elastic_entity_stats(): ) search = search[:0] + search = search.params(request_cache=True) resp = wrap_es_execution(search) buckets = resp.aggregations.paper_like.buckets stats['papers'] = { @@ -322,7 +322,6 @@ def get_elastic_entity_stats(): # container counts search = Search(using=app.es_client, index=app.config['ELASTICSEARCH_CONTAINER_INDEX']) - search = search.params(request_cache=True) search.aggs.bucket( 'release_ref_count', 'sum', @@ -330,6 +329,7 @@ def get_elastic_entity_stats(): ) search = search[:0] # pylint: disable=unsubscriptable-object + search = search.params(request_cache=True) resp = wrap_es_execution(search) stats['container'] = { "total": resp.hits.total, @@ -349,7 +349,6 @@ def get_elastic_container_stats(ident, issnl=None): """ search = Search(using=app.es_client, index=app.config['ELASTICSEARCH_RELEASE_INDEX']) - search = search.params(request_cache=True) search = search.query( 'term', container_id=ident, @@ -371,6 +370,7 @@ def get_elastic_container_stats(ident, issnl=None): ) search = search[:0] + search = search.params(request_cache=True) resp = wrap_es_execution(search) buckets = resp.aggregations.container_stats.buckets @@ -396,7 +396,6 @@ def get_elastic_container_histogram(ident): """ search = Search(using=app.es_client, index=app.config['ELASTICSEARCH_RELEASE_INDEX']) - search = search.params(request_cache='true') search = search.query( 'bool', must=[ @@ -431,6 +430,7 @@ def get_elastic_container_histogram(ident): ) search = search[:0] + search = search.params(request_cache='true') resp = wrap_es_execution(search) buckets = resp.aggregations.year_in_ia.buckets |