aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2019-01-28 22:40:47 -0800
committerBryan Newbold <bnewbold@robocracy.org>2019-01-28 22:40:47 -0800
commitee5640e80f4ab6b8a66009c54e4bc4dca10c17f4 (patch)
treefc34f00e53c6549c30b8b8f2b8ba4051ca01de14
parent1c3d7d7f1bfea647dc5f1a99ad534fb29c8b0974 (diff)
downloadfatcat-ee5640e80f4ab6b8a66009c54e4bc4dca10c17f4.tar.gz
fatcat-ee5640e80f4ab6b8a66009c54e4bc4dca10c17f4.zip
elastic doesn't do well with nullables
-rw-r--r--python/fatcat_tools/transforms.py28
1 files changed, 14 insertions, 14 deletions
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