Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Local qdrant client should return deepcopy of Payloads #624

Closed
hv0905 opened this issue May 10, 2024 · 1 comment
Closed

Local qdrant client should return deepcopy of Payloads #624

hv0905 opened this issue May 10, 2024 · 1 comment
Assignees

Comments

@hv0905
Copy link

hv0905 commented May 10, 2024

Currently, there's a discrepancy in behavior between the local and remote Qdrant clients regarding the payloads returned by search or scroll operations.

Problem:
In the local Qdrant client, whether using in-memory storage or local files, the payload returned by search or scroll operations is the original copy. Consequently, any edits made to this payload affect the corresponding data in the database directly, without necessitating a call to set_payload.

However, the behavior is different in the remote Qdrant client. Each payload returned by a search operation is a fresh copy. Modifications to this payload do not impact the corresponding data in the database unless set_payload is called to explicitly update the new payload.

Proposal:
To align the behavior of the local Qdrant client with that of the remote client and ensure consistency across both, I propose modifying the local client to return a deepcopy of the payload when querying. This approach will maintain the expected behavior where modifications to the returned payload do not directly affect the data in the database unless set_payload is invoked.

Implementation:
Introduce a deepcopy mechanism within the local Qdrant client's search and scroll functions to ensure that a new copy of the payload is returned for each query. This would involve utilizing Python's copy.deepcopy() method or a similar mechanism to create a deep copy of the payload object before returning it to the caller.

Expected Outcome:
By implementing this modification, users of the local Qdrant client will experience behavior consistent with the remote client. This change will enhance the predictability and reliability of interactions with Qdrant across different client environments.

@generall
Copy link
Member

makes sense! Thanks for pointing out!

@joein joein self-assigned this May 10, 2024
This was referenced May 15, 2024
@joein joein closed this as completed Jul 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants