1
0
mirror of https://github.com/ilri/dspace-statistics-api.git synced 2024-12-22 12:42:19 +01:00

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.
This commit is contained in:
Alan Orth 2018-09-19 01:48:35 +03:00
parent 24af83b03f
commit 8e29fd8a43
Signed by: alanorth
GPG Key ID: 0FB860CC9C45B1B9

6
app.py
View File

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