From ee5640e80f4ab6b8a66009c54e4bc4dca10c17f4 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Mon, 28 Jan 2019 22:40:47 -0800 Subject: elastic doesn't do well with nullables --- python/fatcat_tools/transforms.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'python/fatcat_tools') diff --git a/python/fatcat_tools/transforms.py b/python/fatcat_tools/transforms.py index 51689a2e..b9b22e0b 100644 --- a/python/fatcat_tools/transforms.py +++ b/python/fatcat_tools/transforms.py @@ -205,12 +205,12 @@ def release_to_elasticsearch(entity): if is_longtail_oa: is_oa = True - t['is_oa'] = is_oa - t['is_longtail_oa'] = is_longtail_oa - t['in_kbart'] = in_kbart - t['in_jstor'] = in_jstor - t['in_web'] = in_web - t['in_dweb'] = in_dweb + t['is_oa'] = bool(is_oa) + t['is_longtail_oa'] = bool(is_longtail_oa) + t['in_kbart'] = bool(in_kbart) + t['in_jstor'] = bool(in_jstor) + t['in_web'] = bool(in_web) + t['in_dweb'] = bool(in_dweb) t['in_ia'] = bool(in_ia) t['is_preserved'] = bool(is_preserved or in_ia or in_kbart or in_jstor) return t @@ -288,14 +288,14 @@ def container_to_elasticsearch(entity): if extra['ia'].get('sim'): any_ia_sim = True - t['in_doaj'] = in_doaj - t['in_road'] = in_road - t['in_doi'] = in_doi - t['in_sherpa_romeo'] = in_sherpa_romeo - t['is_oa'] = in_doaj or in_road or is_longtail_oa or is_oa - t['is_longtail_oa'] = is_longtail_oa - t['any_kbart'] = any_kbart - t['any_jstor'] = any_jstor + t['in_doaj'] = bool(in_doaj) + t['in_road'] = bool(in_road) + t['in_doi'] = bool(in_doi) + t['in_sherpa_romeo'] = bool(in_sherpa_romeo) + t['is_oa'] = bool(in_doaj or in_road or is_longtail_oa or is_oa) + t['is_longtail_oa'] = bool(is_longtail_oa) + t['any_kbart'] = bool(any_kbart) + t['any_jstor'] = bool(any_jstor) t['any_ia_sim'] = bool(any_ia_sim) return t -- cgit v1.2.3