コード例 #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
ファイル: connection.py プロジェクト: octopart/solrcloudpy
    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
ファイル: connection.py プロジェクト: edwinjhlee/solrcloudpy
    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
ファイル: connection.py プロジェクト: octopart/solrcloudpy
    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
ファイル: schema.py プロジェクト: relwell/solrcloudpy
 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
ファイル: stats.py プロジェクト: fei-cheng/solrcloudpy
 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
ファイル: stats.py プロジェクト: relwell/solrcloudpy
 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
ファイル: connection.py プロジェクト: andresau/solrcloudpy
    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
ファイル: connection.py プロジェクト: solrcloudpy/solrcloudpy
    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
ファイル: schema.py プロジェクト: dalegaspi/solrcloudpy
 def __init__(self,connection,collection_name):
     self.connection = connection
     self.collection_name = collection_name
     self.client = _Request(connection)
コード例 #12
0
ファイル: stats.py プロジェクト: octopart/solrcloudpy
 def __init__(self, connection, name):
     self.connection = connection
     self.name = name
     self.client = _Request(connection)