aboutsummaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2018-09-27 23:56:56 -0700
committerBryan Newbold <bnewbold@robocracy.org>2018-09-27 23:56:56 -0700
commitb4439fea36278b24916a82db9f1883bfbd032e32 (patch)
tree878264d1969bebe6db3bc040ad86815578351328 /python
parent03a17e69195c6e3bf3c5003ddead34f5d1f52760 (diff)
downloadfatcat-b4439fea36278b24916a82db9f1883bfbd032e32.tar.gz
fatcat-b4439fea36278b24916a82db9f1883bfbd032e32.zip
search creator name unicode work-around
Diffstat (limited to 'python')
-rw-r--r--python/fatcat/search.py7
-rw-r--r--python/fatcat/templates/release_search.html1
2 files changed, 5 insertions, 3 deletions
diff --git a/python/fatcat/search.py b/python/fatcat/search.py
index 959bb85f..0b038859 100644
--- a/python/fatcat/search.py
+++ b/python/fatcat/search.py
@@ -6,7 +6,7 @@ from fatcat import app
def do_search(q, limit=20):
- print("Search hit: " + q)
+ #print("Search hit: " + q)
if limit > 100:
# Sanity check
limit = 100
@@ -35,12 +35,15 @@ def do_search(q, limit=20):
abort(resp.status_code)
content = resp.json()
- print(content)
+ #print(content)
results = [h['_source'] for h in content['hits']['hits']]
for h in results:
# Ensure 'contrib_names' is a list, not a single string
if type(h['contrib_names']) is not list:
h['contrib_names'] = [h['contrib_names'], ]
+ # TODO: a total hack; why is elastic sending weird surrogate
+ # characters?
+ h['contrib_names'] = [name.encode('utf8', 'ignore').decode('utf8') for name in h['contrib_names']]
found = content['hits']['total']
return {"query": { "q": q },
diff --git a/python/fatcat/templates/release_search.html b/python/fatcat/templates/release_search.html
index 1f78aaaf..800d550e 100644
--- a/python/fatcat/templates/release_search.html
+++ b/python/fatcat/templates/release_search.html
@@ -28,7 +28,6 @@
{% endif %}
{% if paper.container_is_oa %}<i class="icon unlock orange small"></i>{% endif %}
{% endif %}
- <!-- <br>Date: {{ paper.release_date }} -->
</div>
{% else %}
<br/>