|
|
|
@ -1,7 +1,7 @@
|
|
|
|
|
|
|
|
import hashlib
|
|
|
|
import json
|
|
|
|
import json
|
|
|
|
import logging
|
|
|
|
import logging
|
|
|
|
import uuid
|
|
|
|
import uuid
|
|
|
|
import hashlib
|
|
|
|
|
|
|
|
from contextlib import contextmanager
|
|
|
|
from contextlib import contextmanager
|
|
|
|
from typing import Any
|
|
|
|
from typing import Any
|
|
|
|
|
|
|
|
|
|
|
|
@ -258,15 +258,9 @@ class PGVector(BaseVector):
|
|
|
|
# PG hnsw index only support 2000 dimension or less
|
|
|
|
# PG hnsw index only support 2000 dimension or less
|
|
|
|
# ref: https://github.com/pgvector/pgvector?tab=readme-ov-file#indexing
|
|
|
|
# ref: https://github.com/pgvector/pgvector?tab=readme-ov-file#indexing
|
|
|
|
if dimension <= 2000:
|
|
|
|
if dimension <= 2000:
|
|
|
|
cur.execute(SQL_CREATE_INDEX.format(
|
|
|
|
cur.execute(SQL_CREATE_INDEX.format(table_name=self.table_name, index_hash=self.index_hash))
|
|
|
|
table_name=self.table_name,
|
|
|
|
|
|
|
|
index_hash=self.index_hash
|
|
|
|
|
|
|
|
))
|
|
|
|
|
|
|
|
if self.pg_bigm:
|
|
|
|
if self.pg_bigm:
|
|
|
|
cur.execute(SQL_CREATE_INDEX_PG_BIGM.format(
|
|
|
|
cur.execute(SQL_CREATE_INDEX_PG_BIGM.format(table_name=self.table_name, index_hash=self.index_hash))
|
|
|
|
table_name=self.table_name,
|
|
|
|
|
|
|
|
index_hash=self.index_hash
|
|
|
|
|
|
|
|
))
|
|
|
|
|
|
|
|
redis_client.set(collection_exist_cache_key, 1, ex=3600)
|
|
|
|
redis_client.set(collection_exist_cache_key, 1, ex=3600)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|