mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-26 21:51:03 +02:00
Always test for collections
This commit is contained in:
parent
ca86601c2d
commit
ae51a00d31
4 changed files with 16 additions and 4 deletions
|
|
@ -42,7 +42,8 @@ class Processor(DocumentEmbeddingsQueryService):
|
||||||
|
|
||||||
def ensure_collection_exists(self, collection, dim):
|
def ensure_collection_exists(self, collection, dim):
|
||||||
"""Ensure collection exists, create if it doesn't"""
|
"""Ensure collection exists, create if it doesn't"""
|
||||||
if collection != self.last_collection:
|
# Always check if collection exists, even if cached
|
||||||
|
if collection != self.last_collection or not self.qdrant.collection_exists(collection):
|
||||||
if not self.qdrant.collection_exists(collection):
|
if not self.qdrant.collection_exists(collection):
|
||||||
try:
|
try:
|
||||||
self.qdrant.create_collection(
|
self.qdrant.create_collection(
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,8 @@ class Processor(GraphEmbeddingsQueryService):
|
||||||
|
|
||||||
def ensure_collection_exists(self, collection, dim):
|
def ensure_collection_exists(self, collection, dim):
|
||||||
"""Ensure collection exists, create if it doesn't"""
|
"""Ensure collection exists, create if it doesn't"""
|
||||||
if collection != self.last_collection:
|
# Always check if collection exists, even if cached
|
||||||
|
if collection != self.last_collection or not self.qdrant.collection_exists(collection):
|
||||||
if not self.qdrant.collection_exists(collection):
|
if not self.qdrant.collection_exists(collection):
|
||||||
try:
|
try:
|
||||||
self.qdrant.create_collection(
|
self.qdrant.create_collection(
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,8 @@ class Processor(DocumentEmbeddingsStoreService):
|
||||||
message.metadata.collection
|
message.metadata.collection
|
||||||
)
|
)
|
||||||
|
|
||||||
if collection != self.last_collection:
|
# Always check if collection exists, even if cached
|
||||||
|
if collection != self.last_collection or not self.qdrant.collection_exists(collection):
|
||||||
|
|
||||||
if not self.qdrant.collection_exists(collection):
|
if not self.qdrant.collection_exists(collection):
|
||||||
|
|
||||||
|
|
@ -176,6 +177,10 @@ class Processor(DocumentEmbeddingsStoreService):
|
||||||
if self.qdrant.collection_exists(collection_name):
|
if self.qdrant.collection_exists(collection_name):
|
||||||
self.qdrant.delete_collection(collection_name)
|
self.qdrant.delete_collection(collection_name)
|
||||||
logger.info(f"Deleted Qdrant collection: {collection_name}")
|
logger.info(f"Deleted Qdrant collection: {collection_name}")
|
||||||
|
|
||||||
|
# Clear cache if we just deleted the cached collection
|
||||||
|
if self.last_collection == collection_name:
|
||||||
|
self.last_collection = None
|
||||||
else:
|
else:
|
||||||
logger.info(f"Collection {collection_name} does not exist, nothing to delete")
|
logger.info(f"Collection {collection_name} does not exist, nothing to delete")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,8 @@ class Processor(GraphEmbeddingsStoreService):
|
||||||
"t_" + user + "_" + collection
|
"t_" + user + "_" + collection
|
||||||
)
|
)
|
||||||
|
|
||||||
if cname != self.last_collection:
|
# Always check if collection exists, even if cached
|
||||||
|
if cname != self.last_collection or not self.qdrant.collection_exists(cname):
|
||||||
|
|
||||||
if not self.qdrant.collection_exists(cname):
|
if not self.qdrant.collection_exists(cname):
|
||||||
|
|
||||||
|
|
@ -183,6 +184,10 @@ class Processor(GraphEmbeddingsStoreService):
|
||||||
if self.qdrant.collection_exists(collection_name):
|
if self.qdrant.collection_exists(collection_name):
|
||||||
self.qdrant.delete_collection(collection_name)
|
self.qdrant.delete_collection(collection_name)
|
||||||
logger.info(f"Deleted Qdrant collection: {collection_name}")
|
logger.info(f"Deleted Qdrant collection: {collection_name}")
|
||||||
|
|
||||||
|
# Clear cache if we just deleted the cached collection
|
||||||
|
if self.last_collection == collection_name:
|
||||||
|
self.last_collection = None
|
||||||
else:
|
else:
|
||||||
logger.info(f"Collection {collection_name} does not exist, nothing to delete")
|
logger.info(f"Collection {collection_name} does not exist, nothing to delete")
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue