From 2c01ebb72c76b8f27ec4d2965f59a7a7165f2bf2 Mon Sep 17 00:00:00 2001 From: Steven Joseph Date: Sat, 28 Oct 2017 11:53:33 +1100 Subject: [PATCH 1/6] Expose facet_counts in riak http results --- riak/codecs/http.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/riak/codecs/http.py b/riak/codecs/http.py index bfc91f2c..5da99961 100644 --- a/riak/codecs/http.py +++ b/riak/codecs/http.py @@ -229,6 +229,8 @@ def _normalize_json_search_response(self, json): if u'response' in json: result['num_found'] = json[u'response'][u'numFound'] result['max_score'] = float(json[u'response'][u'maxScore']) + if 'facet_counts' in json: + result['facet_counts'] = json[u'facet_counts'] docs = [] for doc in json[u'response'][u'docs']: resdoc = {} From 648f9056d47332df890232e85d497623608e2964 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=B4mulo=20A=2E=20Ceccon?= Date: Mon, 19 Mar 2018 15:05:41 +0100 Subject: [PATCH 2/6] Do not use deprecated argument `verbose` in namedtuple Argument `verbose` to nametuple constructor was deprecated in Python 3.3, and was removed in Python 3.7. --- riak/codecs/__init__.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/riak/codecs/__init__.py b/riak/codecs/__init__.py index 00324f14..b824fcc0 100644 --- a/riak/codecs/__init__.py +++ b/riak/codecs/__init__.py @@ -21,8 +21,7 @@ from riak.util import bytes_to_str Msg = collections.namedtuple('Msg', - ['msg_code', 'data', 'resp_code'], - verbose=False) + ['msg_code', 'data', 'resp_code']) class Codec(object): From 95e61a03ce6e51289aa184a618f7462ff7fd602f Mon Sep 17 00:00:00 2001 From: bryanhuntesl <31992054+bryanhuntesl@users.noreply.github.com> Date: Mon, 19 Mar 2018 18:25:02 +0000 Subject: [PATCH 3/6] disable spurious flake8 python style warnings --- .travis.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.sh b/.travis.sh index 497de259..40518170 100755 --- a/.travis.sh +++ b/.travis.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -o errexit -flake8 --exclude=riak/pb riak *.py +flake8 --ignore E722,E741 --exclude=riak/pb riak *.py sudo riak-admin security disable From c52b745a96115426205d7c8a6245902cf2441b3b Mon Sep 17 00:00:00 2001 From: bryanhuntesl <31992054+bryanhuntesl@users.noreply.github.com> Date: Mon, 19 Mar 2018 18:43:41 +0000 Subject: [PATCH 4/6] and again... add more exclusions.. --- .travis.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.sh b/.travis.sh index 40518170..739c66cd 100755 --- a/.travis.sh +++ b/.travis.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -o errexit -flake8 --ignore E722,E741 --exclude=riak/pb riak *.py +flake8 --ignore E123,E126,E226,E722,E741 --exclude=riak/pb riak *.py sudo riak-admin security disable From b3a7d2d2c2621efc3cbf7a339a2341ff4da882bd Mon Sep 17 00:00:00 2001 From: bryanhuntesl <31992054+bryanhuntesl@users.noreply.github.com> Date: Mon, 19 Mar 2018 18:54:49 +0000 Subject: [PATCH 5/6] Reduce test time - test only 2.7, 3.6, and nightly test only 2.7 (stable), 3.6 (3 series stable) and nightly - the matrix was too big - 3.2, 3.3, 3.4, and 3.5 are the least used. --- .travis.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 90f86d41..7c46a5cd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,9 +3,6 @@ dist: trusty language: python python: - '2.7' - - '3.3' - - '3.4' - - '3.5' - '3.6' - nightly addons: From 3a2bf990db0792a3ba00719db5fa1651c89ce758 Mon Sep 17 00:00:00 2001 From: Steven Joseph Date: Tue, 20 Mar 2018 10:11:43 +1100 Subject: [PATCH 6/6] Expose more result types from solr results --- riak/codecs/http.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/riak/codecs/http.py b/riak/codecs/http.py index 5da99961..b981b77a 100644 --- a/riak/codecs/http.py +++ b/riak/codecs/http.py @@ -226,11 +226,15 @@ def _normalize_json_search_response(self, json): same return value """ result = {} + if 'facet_counts' in json: + result['facet_counts'] = json[u'facet_counts'] + if 'grouped' in json: + result['grouped'] = json[u'grouped'] + if 'stats' in json: + result['stats'] = json[u'stats'] if u'response' in json: result['num_found'] = json[u'response'][u'numFound'] result['max_score'] = float(json[u'response'][u'maxScore']) - if 'facet_counts' in json: - result['facet_counts'] = json[u'facet_counts'] docs = [] for doc in json[u'response'][u'docs']: resdoc = {}