From 8e29fd8a43a8d1c58c4da0d9d761197db81d3c9d Mon Sep 17 00:00:00 2001 From: Alan Orth Date: Wed, 19 Sep 2018 01:48:35 +0300 Subject: [PATCH] app.py: Use rows=0 for Solr queries There is no need to return any rows of the result because I am only interested in the numFound. --- app.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app.py b/app.py index ff863b8..fab0adf 100644 --- a/app.py +++ b/app.py @@ -19,7 +19,8 @@ class ItemResource: # Get views res = solr.query(SOLR_CORE, { 'q':'type:0', - 'fq':'owningItem:{0} AND isBot:false AND statistics_type:view AND -bundleName:ORIGINAL'.format(item_id) + 'fq':'owningItem:{0} AND isBot:false AND statistics_type:view AND -bundleName:ORIGINAL'.format(item_id), + 'rows':0 }) views = res.get_num_found() @@ -27,7 +28,8 @@ class ItemResource: # Get downloads res = solr.query(SOLR_CORE, { 'q':'type:0', - 'fq':'owningItem:{0} AND isBot:false AND statistics_type:view AND bundleName:ORIGINAL'.format(item_id) + 'fq':'owningItem:{0} AND isBot:false AND statistics_type:view AND bundleName:ORIGINAL'.format(item_id), + 'rows':0 }) downloads = res.get_num_found()