I am trying to create a collection which totally works fine like this
try:
collection_name = generate_collection_name(request.id)
client.collections.create(
collection_name,
vectorizer_config=[
Configure.NamedVectors.text2vec_transformers(
name="filename", source_properties=["filecontent"]
)
],
)
But when I try to insert I need to check before if there is an object exist and when I filter it by filename then it says filename is not available my code is
# Query to check if the embedding already exists
existing_embeddings = collection.query.fetch_objects(
filters=Filter.by_property("filename").equal(request.id),limit=1)
# If embedding exists, delete it
if len(existing_embeddings.objects)>0:
print(f"Existing embedding found. Deleting: {request.id}")
collection.data.delete_many(
where=Filter.by_property("filename").equal(request.id)
)
# Add the new embedding
print(f"Adding new embedding: {request.id}")
with collection.batch.dynamic() as batch:
batch.add_object(properties=data_row)
checking if exist then delete otherwise add, BUT on the very FIRST INSERTION it says filename not found as property but then one more thing if I even add filename in properties at creation time of class like this
Configure.NamedVectors.text2vec_transformers(
name="vector_data", source_properties=["filename","filecontent"]
)
I get same error is there any way to sort and check with filter by at start plus I can not use uids because I have to fetch my collection at a time against file ids and then obviously i will have to store that as well.