def get_autocomplete(self): autocomplete = {} try: api = SolrApi(SOLR_URL.get(), self.user, SECURITY_ENABLED.get()) autocomplete['collections'] = api.collections2() autocomplete['configs'] = api.configs() except Exception, e: LOG.warn('No Zookeeper servlet running on Solr server: %s' % e)
def _fetch_collections(request): from libsolr.api import SolrApi from search.conf import SOLR_URL path = request.GET['path'] item = None name = None if path: item = path if '/' in path: item, name = path.split('/') api = SolrApi(SOLR_URL.get(), request.user) if not item: return {"databases": ["collections", "configs", "admin"]} elif item and name: return { "authorizable_link": "/indexer/#edit/%s" % name, "extended_columns": [], "columns": [], "partition_keys": [] } elif item == 'collections': return { "tables_meta": [{ "comment": None, "type": "Table", "name": col } for col in api.collections2()] } elif item == 'configs': return { "tables_meta": [{ "comment": None, "type": "Table", "name": conf } for conf in api.configs()] } elif item == 'admin': return { "tables_meta": [{ "comment": None, "type": "Table", "name": 'collections' }, { "comment": None, "type": "Table", "name": "cores" }] } else: raise PopupException( _('Authorizable %s could not be retrieved') % path)
def _fetch_collections(request): from search.conf import SOLR_URL path = request.GET['path'] item = None name = None if path: item = path if '/' in path: item, name = path.split('/') api = SolrApi(SOLR_URL.get(), request.user) if not item: return {"databases": ["collections", "configs"]} elif item and name: return {"authorizable_link": "/indexer/#edit/%s" % name, "extended_columns": [], "columns": [], "partition_keys": []} elif item == 'collections': return {"tables_meta": [{"comment": None, "type": "Table", "name": col} for col in api.collections2()]} elif item == 'configs': return {"tables_meta": [{"comment": None, "type": "Table", "name": conf} for conf in api.configs()]} else: raise PopupException(_('Authorizable %s could not be retrieved') % path)