-
Notifications
You must be signed in to change notification settings - Fork 237
Closed
Description
I want to delete all the embeddings, but it seems like del docs_query[...][:, 'embedding'] deletes only the embeddings of unique documents. In my case, matches of the query documents overlap, so it deletes each an embedding of a unique document only once. I'm providing an example:
from docarray import DocumentArray, Document
import numpy as np
docs_query = DocumentArray([
Document(embedding=np.array([1, 2, 3])),
Document(embedding=np.array([1, 2, 3])),
# Document(embedding=np.array([1, 2, 3]))
])
docs_index = DocumentArray([
Document(embedding=np.array([1, 2, 3])),
Document(embedding=np.array([1, 2, 3]))
])
docs_query.match(docs_index)
del docs_query[...][:, 'embedding']
print(len(list(1 for doc in docs_query[...] if doc.embedding is not None)))
Output:
2
6 total docs - 2 unique query docs - 2 unique index docs = 2
You may uncomment the line and get 4 as an output. In that case it's gonna be
9 total docs - 3 unique query docs - 2 unique index docs = 4
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels