From ed9d25294e4245c47bed718317e746f98883ba0a Mon Sep 17 00:00:00 2001 From: Alan Orth Date: Wed, 19 Sep 2018 12:48:28 +0300 Subject: [PATCH] app.py: Use SolrClient's rows parameter Instead of putting this in the raw query we can just use SolrClient's native rows parameter. --- app.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/app.py b/app.py index fab0adf..a06a7cd 100644 --- a/app.py +++ b/app.py @@ -19,18 +19,16 @@ 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), - 'rows':0 - }) + 'fq':'owningItem:{0} AND isBot:false AND statistics_type:view AND -bundleName:ORIGINAL'.format(item_id) + }, rows=0) views = res.get_num_found() # 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), - 'rows':0 - }) + 'fq':'owningItem:{0} AND isBot:false AND statistics_type:view AND bundleName:ORIGINAL'.format(item_id) + }, rows=0) downloads = res.get_num_found()