Skip to content

Commit 7af9123

Browse files
Function to recreate collections (#47)
1 parent b8b9883 commit 7af9123

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

upgrade_logic/business_objects/neural_search.py

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,37 @@
77
NEURAL_SEARCH = os.getenv("NEURAL_SEARCH")
88

99

10+
def neural_search_1_12_0() -> bool:
11+
__neural_search_1_12_0_update_qdrant()
12+
return True
13+
14+
15+
def __neural_search_1_12_0_update_qdrant() -> bool:
16+
print("upgrade qdrant version, recreate collections", flush=True)
17+
success = True
18+
19+
# only recreate collections, no need to create missing collections
20+
embedding_items = embedding.get_finished_attribute_embeddings()
21+
22+
url_recreate = f"{NEURAL_SEARCH}/recreate_collection"
23+
for project_id, embedding_id in embedding_items:
24+
params = {
25+
"project_id": str(project_id),
26+
"embedding_id": str(embedding_id),
27+
}
28+
response = requests.post(url=url_recreate, params=params)
29+
30+
if response.status_code != 200:
31+
print(response.content)
32+
success = False
33+
34+
if success:
35+
print("Recreated all collections.", flush=True)
36+
else:
37+
print("Recreating collections failed.", flush=True)
38+
return success
39+
40+
1041
def neural_search_1_2_1() -> bool:
1142
print("upgrade qdrant version, recreate collections", flush=True)
1243
success = __recreate_qdrant_collections()
@@ -18,7 +49,6 @@ def neural_search_1_2_1() -> bool:
1849

1950

2051
def __recreate_qdrant_collections() -> bool:
21-
2252
success = True
2353

2454
# recreate collections

0 commit comments

Comments
 (0)