Revision 54602
Added by Sandro La Bruzzo about 5 years ago
es_connector.py | ||
---|---|---|
106 | 106 |
self.client = Elasticsearch(hosts=self.index_host) |
107 | 107 |
self.index_name = props['api.index'] |
108 | 108 |
|
109 |
def get_main_page_stats(self): |
|
110 |
stats = dict(total =Search(using=self.client, index=self.index_name).doc_type('scholix').execute().hits.total/2) |
|
111 |
for item in ['dataset', 'publication']: |
|
112 |
s= Search(using=self.client, index=self.index_name).doc_type('object').query(Q('match', typology=item)) |
|
113 |
stats[item] = s.execute().hits.total |
|
114 |
return stats |
|
115 |
|
|
109 | 116 |
def query_by_id(self, id): |
110 | 117 |
s = Search(using=self.client, index=self.index_name).doc_type('object') |
111 | 118 |
s = s.query(create_pid_query(id)) |
Also available in: Unified diff
Create dinamically stats on main page