1
0
mirror of https://github.com/ilri/dspace-statistics-api.git synced 2024-11-22 14:25:01 +01:00

app.py: Use SolrClient's rows parameter

Instead of putting this in the raw query we can just use SolrClient's
native rows parameter.
This commit is contained in:
Alan Orth 2018-09-19 12:48:28 +03:00
parent 5e165d2e88
commit ed9d25294e
Signed by: alanorth
GPG Key ID: 0FB860CC9C45B1B9

10
app.py
View File

@ -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()