From b14c3eef4decebe28e9d5f169810e947dff9cc9a Mon Sep 17 00:00:00 2001 From: Alan Orth Date: Thu, 27 Sep 2018 09:51:40 +0300 Subject: [PATCH] indexer.py: Use ujson instead of json Falcon optionally makes use of the ujson library to speed up media (de)serialization, error serialization, and query string parsing. See: https://falcon.readthedocs.io/en/stable/user/install.html --- indexer.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/indexer.py b/indexer.py index 30df506..ae6b620 100755 --- a/indexer.py +++ b/indexer.py @@ -31,7 +31,7 @@ # See: https://wiki.duraspace.org/display/DSPACE/Solr from database import database_connection -import json +import ujson import psycopg2.extras from solr import solr_connection @@ -56,7 +56,7 @@ def index_views(): }, rows=0) # get total number of distinct facets (countDistinct) - results_totalNumFacets = json.loads(res.get_json())['stats']['stats_fields']['id']['countDistinct'] + results_totalNumFacets = ujson.loads(res.get_json())['stats']['stats_fields']['id']['countDistinct'] # divide results into "pages" (cast to int to effectively round down) results_per_page = 100 @@ -115,7 +115,7 @@ def index_downloads(): }, rows=0) # get total number of distinct facets (countDistinct) - results_totalNumFacets = json.loads(res.get_json())['stats']['stats_fields']['owningItem']['countDistinct'] + results_totalNumFacets = ujson.loads(res.get_json())['stats']['stats_fields']['owningItem']['countDistinct'] # divide results into "pages" (cast to int to effectively round down) results_per_page = 100