mirror of
https://github.com/ilri/dspace-statistics-api.git
synced 2024-12-25 14:04:29 +01:00
Refactor Solr components
This makes it so we only need to define and connect once and then we can re-use the connection everywhere else.
This commit is contained in:
parent
84801a4ab5
commit
b0d81a543c
5
app.py
5
app.py
@ -2,10 +2,9 @@
|
||||
# See DSpace Solr docs for tips about parameters
|
||||
# https://wiki.duraspace.org/display/DSPACE/Solr
|
||||
|
||||
from config import SOLR_SERVER
|
||||
from config import SOLR_CORE
|
||||
import falcon
|
||||
from SolrClient import SolrClient
|
||||
from solr import solr_connection
|
||||
|
||||
|
||||
class ItemResource:
|
||||
@ -14,8 +13,6 @@ class ItemResource:
|
||||
# Return HTTPBadRequest if id parameter is not present and valid
|
||||
item_id = req.get_param_as_int("id", required=True, min=0)
|
||||
|
||||
solr = SolrClient(SOLR_SERVER)
|
||||
|
||||
# Get views
|
||||
res = solr.query(SOLR_CORE, {
|
||||
'q':'type:2 AND id:{0}'.format(item_id),
|
||||
|
Loading…
Reference in New Issue
Block a user