예제 #1
0
    def __init__(self,
                 server="localhost:8983",
                 detect_live_nodes=False,
                 user=None,
                 password=None,
                 timeout=10,
                 webappdir='solr'):
        self.user = user
        self.password = password
        self.timeout = timeout
        self.webappdir = webappdir
        self.url_template = 'http://{{server}}/{webappdir}/'.format(
            webappdir=self.webappdir)

        if type(server) == type(''):
            self.url = self.url_template.format(server=server)
            servers = [self.url, self.url]
            if detect_live_nodes:
                url = servers[0]
                self.servers = self.detect_nodes(url)
            else:
                self.servers = servers
        if type(server) == type([]):
            servers = [self.url_template.format(server=a) for a in server]
            if detect_live_nodes:
                url = servers[0]
                self.servers = self.detect_nodes(url)
            else:
                self.servers = servers

        self.client = _Request(self)
예제 #2
0
    def __init__(self,
                 server="localhost:8983",
                 installation='solr',
                 detect_live_nodes=False,
                 user=None,
                 password=None,
                 timeout=10):
        self.user = user
        self.password = password
        self.timeout = timeout
        self.installation = installation

        if type(server) == type(''):
            self.url = "http://%s/%s/" % (server, installation)
            servers = [self.url, self.url]
            if detect_live_nodes:
                url = servers[0]
                self.servers = self.detect_nodes(url)
            else:
                self.servers = servers
        if type(server) == type([]):
            servers = ["http://%s/%s/" % (a, installation) for a in server]
            if detect_live_nodes:
                url = servers[0]
                self.servers = self.detect_nodes(url)
            else:
                self.servers = servers

        self.client = _Request(self)
예제 #3
0
    def __init__(self, server="localhost:8983",
                 detect_live_nodes=False,
                 user=None,
                 password=None,
                 timeout=10,
                 webappdir='solr'):
        self.user = user
        self.password = password
        self.timeout = timeout
        self.webappdir = webappdir
        self.url_template = 'http://{{server}}/{webappdir}/'.format(webappdir=self.webappdir)

        if type(server) == type(''):
            self.url = self.url_template.format(server=server)
            servers = [self.url, self.url]
            if detect_live_nodes:
                url = servers[0]
                self.servers = self.detect_nodes(url)
            else:
                self.servers = servers
        if type(server) == type([]):
            servers = [self.url_template.format(server=a) for a in server]
            if detect_live_nodes:
                url = servers[0]
                self.servers = self.detect_nodes(url)
            else:
                self.servers = servers

        self.client = _Request(self)
예제 #4
0
    def __init__(self,server="localhost:8983",
                 installation='solr',
                 detect_live_nodes=False,
                 user=None,
                 password=None,
                 timeout=10):
        self.user = user
        self.password = password
        self.timeout = timeout
        self.installation = installation
        
        if type(server) == type(''):
            self.url = "http://%s/%s/" % (server, installation)
            servers = [self.url,self.url]
            if detect_live_nodes:
                url = servers[0]
                self.servers = self.detect_nodes(url)
            else:
                self.servers = servers
        if type(server) == type([]):
            servers = ["http://%s/%s/" % (a, installation) for a in server]
            if detect_live_nodes:
                url = servers[0]
                self.servers = self.detect_nodes(url)
            else:
                self.servers = servers

        self.client = _Request(self)
예제 #5
0
 def __init__(self, connection, collection_name):
     """
     :param connection: the connection to solr
     :type connection: SolrConnection
     :param collection_name: the name of the collection related to the schema
     :type collection_name: str
     """
     self.connection = connection
     self.collection_name = collection_name
     self.client = _Request(connection)
예제 #6
0
 def __init__(self, connection, collection_name):
     """
     :param connection: the connection to solr
     :type connection: SolrConnection
     :param collection_name: the name of the collection related to the schema
     :type collection_name: str
     """
     self.connection = connection
     self.collection_name = collection_name
     self.client = _Request(connection)
예제 #7
0
 def __init__(self, connection, name):
     """
     :param connection: the connection to solr
     :type connection: SolrConnection
     :param name: the name of the index
     :type name: str
     """
     self.connection = connection
     self.name = name
     self.client = _Request(connection)
예제 #8
0
 def __init__(self, connection, name):
     """
     :param connection: the connection to solr
     :type connection: SolrConnection
     :param name: the name of the index
     :type name: str
     """
     self.connection = connection
     self.name = name
     self.client = _Request(connection)
예제 #9
0
    def __init__(self,
                 server="localhost:8983",
                 detect_live_nodes=False,
                 user=None,
                 password=None,
                 timeout=10,
                 webappdir='solr',
                 version='5.3.0',
                 request_retries=1,
                 use_https=False):
        self.user = user
        self.password = password
        self.timeout = timeout
        self.webappdir = webappdir
        self.version = version
        self.request_retries = request_retries

        if not semver.match(version, MIN_SUPPORTED_VERSION) and semver.match(
                version, MAX_SUPPORTED_VERSION):
            raise Exception("Unsupported version %s" % version)

        if semver.match(self.version, '<5.4.0'):
            self.zk_path = '/{webappdir}/zookeeper'.format(
                webappdir=self.webappdir)
        else:
            self.zk_path = '/{webappdir}/admin/zookeeper'.format(
                webappdir=self.webappdir)

        protocol = "https" if use_https else "http"

        self.url_template = '{protocol}://{{server}}/{webappdir}/'.format(
            protocol=protocol, webappdir=self.webappdir)

        if type(server) == str:
            self.url = self.url_template.format(server=server)
            servers = [self.url, self.url]
            if detect_live_nodes:
                url = servers[0]
                self.servers = self.detect_nodes(url)
            else:
                self.servers = servers
        if type(server) == list:
            servers = [self.url_template.format(server=a) for a in server]
            if detect_live_nodes:
                url = servers[0]
                self.servers = self.detect_nodes(url)
            else:
                self.servers = servers

        self.client = _Request(self)
예제 #10
0
    def __init__(self, server="localhost:8983",
                 detect_live_nodes=False,
                 user=None,
                 password=None,
                 timeout=10,
                 webappdir='solr',
                 version='5.3.0',
                 request_retries=1,
                 use_https=False):
        self.user = user
        self.password = password
        self.timeout = timeout
        self.webappdir = webappdir
        self.version = version
        self.request_retries = request_retries

        if not semver.match(version, MIN_SUPPORTED_VERSION) and semver.match(version, MAX_SUPPORTED_VERSION):
            raise Exception("Unsupported version %s" % version)

        if semver.match(self.version, '<5.4.0'):
            self.zk_path = '/{webappdir}/zookeeper'.format(webappdir=self.webappdir)
        else:
            self.zk_path = '/{webappdir}/admin/zookeeper'.format(webappdir=self.webappdir)
        
        protocol = "https" if use_https else "http"
        
        self.url_template = '{protocol}://{{server}}/{webappdir}/'.format(protocol=protocol, webappdir=self.webappdir)

        if type(server) == str:
            self.url = self.url_template.format(server=server)
            servers = [self.url, self.url]
            if detect_live_nodes:
                url = servers[0]
                self.servers = self.detect_nodes(url)
            else:
                self.servers = servers
        if type(server) == list:
            servers = [self.url_template.format(server=a) for a in server]
            if detect_live_nodes:
                url = servers[0]
                self.servers = self.detect_nodes(url)
            else:
                self.servers = servers

        self.client = _Request(self)
예제 #11
0
 def __init__(self,connection,collection_name):
     self.connection = connection
     self.collection_name = collection_name
     self.client = _Request(connection)
예제 #12
0
 def __init__(self, connection, name):
     self.connection = connection
     self.name = name
     self.client = _Request(connection)