Skip to content

Commit c10449c

Browse files
dong xiangdong xiang
authored andcommitted
fix: support qdrant v8.0 on docarray
1 parent 125eb3a commit c10449c

5 files changed

Lines changed: 15 additions & 15 deletions

File tree

docarray/array/storage/qdrant/backend.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ def _init_storage(
8181
config.collection_name = self._tmp_collection_name()
8282

8383
self._n_dim = config.n_dim
84+
self._distance = config.distance
8485
self._serialize_config = config.serialize_config
8586

8687
self._client = QdrantClient(host=config.host, port=config.port)
@@ -134,17 +135,17 @@ def _initialize_qdrant_schema(self):
134135
m=self._config.m,
135136
)
136137
self.client.http.collections_api.create_collection(
137-
self.collection_name,
138-
CreateCollection(
139-
vector_size=self.n_dim,
140-
distance=self.distance,
138+
collection_name=self.collection_name,
139+
create_collection=CreateCollection(
140+
vector_size=self._n_dim,
141+
distance=DISTANCES[self._distance],
141142
hnsw_config=hnsw_config,
142143
),
143144
)
144145

145146
def _collection_exists(self, collection_name):
146-
resp = self.client.http.collections_api.get_collections()
147-
collections = [collection.name for collection in resp.result.collections]
147+
resp = self.client.get_collections()
148+
collections = [collection.name for collection in resp.collections]
148149
return collection_name in collections
149150

150151
@staticmethod
@@ -170,15 +171,14 @@ def __setstate__(self, state):
170171
def _get_offset2ids_meta(self) -> List[str]:
171172
if not self._collection_exists(self.collection_name_meta):
172173
return []
173-
return self.client.http.points_api.get_point(
174-
self.collection_name_meta, id=1
175-
).result.payload['offset2id']
174+
return self.client.retrieve(collection_name=self.collection_name_meta, ids=[1])
176175

177176
def _update_offset2ids_meta(self):
178177
if not self._collection_exists(self.collection_name_meta):
179-
self.client.http.collections_api.create_collection(
178+
self.client.recreate_collection(
180179
self.collection_name_meta,
181-
CreateCollection(vector_size=1, distance=Distance.COSINE),
180+
vector_size=1,
181+
distance=Distance.COSINE,
182182
)
183183

184184
self.client.http.points_api.upsert_points(

docs/advanced/document-store/qdrant.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ server. Create `docker-compose.yml` as follows:
1919
version: '3.4'
2020
services:
2121
qdrant:
22-
image: qdrant/qdrant:v0.7.0
22+
image: qdrant/qdrant:v0.8.0
2323
ports:
2424
- "6333:6333"
2525
ulimits: # Only required for tests, as there are a lot of collections created

scripts/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ services:
1010
AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED: 'true'
1111
PERSISTENCE_DATA_PATH: '/var/lib/weaviate'
1212
qdrant:
13-
image: qdrant/qdrant:v0.7.0
13+
image: qdrant/qdrant:v0.8.0
1414
ports:
1515
- "41233:41233"
1616
ulimits: # Only required for tests, as there are a lot of collections created

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
'strawberry-graphql',
6666
],
6767
'qdrant': [
68-
'qdrant-client~=0.7.3',
68+
'qdrant-client==0.8.0',
6969
],
7070
'annlite': [
7171
'annlite>=0.3.12',

tests/unit/array/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ services:
1010
AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED: 'true'
1111
PERSISTENCE_DATA_PATH: '/var/lib/weaviate'
1212
qdrant:
13-
image: qdrant/qdrant:v0.7.0
13+
image: qdrant/qdrant:v0.8.0
1414
ports:
1515
- "6333:6333"
1616
ulimits: # Only required for tests, as there are a lot of collections created

0 commit comments

Comments
 (0)