Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,6 @@ public static VectorStoreCollection<TKey, TRecord> GetVectorCollection<TKey, TRe
where TRecord : class
{
IDatabase database;
VectorStore vectorStore;
VectorStoreCollection<TKey, TRecord> collection = null;

//TODO: If the logic becomes overly complex in the future, different combinations can be considered to be separated into different libraries
Expand All @@ -253,8 +252,10 @@ public static VectorStoreCollection<TKey, TRecord> GetVectorCollection<TKey, TRe
{
case VectorDBType.Memory:
{
vectorStore = new InMemoryVectorStore();
collection = vectorStore.GetCollection<TKey, TRecord>(name, vectorStoreRecordDefinition);
using (var inMemoryVectorStore = new InMemoryVectorStore())
{
collection = inMemoryVectorStore.GetCollection<TKey, TRecord>(name, vectorStoreRecordDefinition);
}
break;
}
case VectorDBType.HardDisk:
Expand Down Expand Up @@ -293,13 +294,17 @@ public static VectorStoreCollection<TKey, TRecord> GetVectorCollection<TKey, TRe
}
case VectorDBType.Qdrant:
{
vectorStore = new QdrantVectorStore(new QdrantClient(vectorDb.ConnectionString), ownsClient: true);
collection = vectorStore.GetCollection<TKey, TRecord>(name, vectorStoreRecordDefinition);
using (var qdrantVectorStore = new QdrantVectorStore(new QdrantClient(vectorDb.ConnectionString), ownsClient: true))
{
collection = qdrantVectorStore.GetCollection<TKey, TRecord>(name, vectorStoreRecordDefinition);
}
break;
}
default:
vectorStore = new InMemoryVectorStore();
collection = vectorStore.GetCollection<TKey, TRecord>(name, vectorStoreRecordDefinition);
using (var inMemoryVectorStore = new InMemoryVectorStore())
{
collection = inMemoryVectorStore.GetCollection<TKey, TRecord>(name, vectorStoreRecordDefinition);
}
break;
}

Expand Down
Loading