mirror of
https://github.com/ilri/dspace-statistics-api.git
synced 2024-11-25 23:58:18 +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:
parent
5e165d2e88
commit
ed9d25294e
10
app.py
10
app.py
@ -19,18 +19,16 @@ class ItemResource:
|
|||||||
# Get views
|
# Get views
|
||||||
res = solr.query(SOLR_CORE, {
|
res = solr.query(SOLR_CORE, {
|
||||||
'q':'type:0',
|
'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
|
}, rows=0)
|
||||||
})
|
|
||||||
|
|
||||||
views = res.get_num_found()
|
views = res.get_num_found()
|
||||||
|
|
||||||
# Get downloads
|
# Get downloads
|
||||||
res = solr.query(SOLR_CORE, {
|
res = solr.query(SOLR_CORE, {
|
||||||
'q':'type:0',
|
'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
|
}, rows=0)
|
||||||
})
|
|
||||||
|
|
||||||
downloads = res.get_num_found()
|
downloads = res.get_num_found()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user