Exemplo n.º 1
0
 def __init__(self, metric, index_type, nlist):
     self._nlist = nlist
     self._nprobe = None
     self._metric = metric
     self._milvus = milvus.Milvus()
     self._milvus.connect(host='localhost', port='19530')
     self._table_name = 'test01'
     self._index_type = index_type
Exemplo n.º 2
0
def get_milvus_client():
    if 'milvus_client' not in g:
        client = milvus.Milvus(uri=current_app.config['MILVUS_URI'])
        if not client.connected():
            log.error("can not connect milvus:%s" %
                      current_app.config['MILVUS_URI'])
            exit(-1)
        g.milvus_client = client
    return g.milvus_client
Exemplo n.º 3
0
 def __init__(self, metric, index_type, nlist):
     self._index_param = {'nlist': nlist}
     self._search_param = {'nprobe': None}
     self._metric = metric
     self._milvus = milvus.Milvus(host='localhost',
                                  port='19530',
                                  try_connect=False,
                                  pre_ping=False)
     self._table_name = 'test01'
     self._index_type = index_type
Exemplo n.º 4
0
    def get_milvus(self) -> mv.Milvus:
        """
        获取可用的milvus连接对象

        @returns {Milvus} - 返回要使用的Milvus对象
        """
        return mv.Milvus(
            host=self.milvus_para['host'], port=self.milvus_para['port'],
            pool=self.milvus_para.get('pool', 'SingletonThread')
        )