1
0
mirror of https://github.com/ilri/dspace-statistics-api.git synced 2024-11-26 08:08:19 +01:00

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
This commit is contained in:
Alan Orth 2018-09-27 09:51:40 +03:00
parent 71a789b13f
commit b14c3eef4d
Signed by: alanorth
GPG Key ID: 0FB860CC9C45B1B9

View File

@ -31,7 +31,7 @@
# See: https://wiki.duraspace.org/display/DSPACE/Solr # See: https://wiki.duraspace.org/display/DSPACE/Solr
from database import database_connection from database import database_connection
import json import ujson
import psycopg2.extras import psycopg2.extras
from solr import solr_connection from solr import solr_connection
@ -56,7 +56,7 @@ def index_views():
}, rows=0) }, rows=0)
# get total number of distinct facets (countDistinct) # 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) # divide results into "pages" (cast to int to effectively round down)
results_per_page = 100 results_per_page = 100
@ -115,7 +115,7 @@ def index_downloads():
}, rows=0) }, rows=0)
# get total number of distinct facets (countDistinct) # 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) # divide results into "pages" (cast to int to effectively round down)
results_per_page = 100 results_per_page = 100