Commit a0c797a
fix: replace in-place dataclass mutations in document stores (#3114)
* fix: replace in-place dataclass mutations in document stores
Replaces direct field assignments on Document instances with
dataclasses.replace(), removing DeprecationWarnings from haystack#10650.
Affected stores:
- elasticsearch: doc.score in BM25 score scaling (sync + async)
- opensearch: doc.score in BM25 score scaling
- pinecone: doc.score in filter_documents (sync + async),
document.meta in _update_meta_for_documents and _discard_invalid_meta
- qdrant: document.score in score scaling
Part of deepset-ai/haystack#10956
* fix(pinecone): fix PLW2901 and update tests for non-mutating _discard_invalid_meta
---------
Co-authored-by: David S. Batista <dsbatista@gmail.com>1 parent b5aa532 commit a0c797a
5 files changed
Lines changed: 52 additions & 42 deletions
File tree
- integrations
- elasticsearch/src/haystack_integrations/document_stores/elasticsearch
- opensearch/src/haystack_integrations/document_stores/opensearch
- pinecone
- src/haystack_integrations/document_stores/pinecone
- tests
- qdrant/src/haystack_integrations/document_stores/qdrant
Lines changed: 13 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
904 | 905 | | |
905 | 906 | | |
906 | 907 | | |
907 | | - | |
908 | | - | |
909 | | - | |
910 | | - | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
911 | 914 | | |
912 | 915 | | |
913 | 916 | | |
| |||
962 | 965 | | |
963 | 966 | | |
964 | 967 | | |
965 | | - | |
966 | | - | |
967 | | - | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
968 | 974 | | |
969 | 975 | | |
970 | 976 | | |
| |||
Lines changed: 7 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
940 | 941 | | |
941 | 942 | | |
942 | 943 | | |
943 | | - | |
944 | | - | |
945 | | - | |
946 | | - | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
947 | 950 | | |
948 | 951 | | |
949 | 952 | | |
| |||
Lines changed: 11 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
310 | 311 | | |
311 | 312 | | |
312 | 313 | | |
313 | | - | |
314 | | - | |
| 314 | + | |
315 | 315 | | |
316 | 316 | | |
317 | 317 | | |
| |||
336 | 336 | | |
337 | 337 | | |
338 | 338 | | |
339 | | - | |
340 | | - | |
| 339 | + | |
341 | 340 | | |
342 | 341 | | |
343 | 342 | | |
| |||
399 | 398 | | |
400 | 399 | | |
401 | 400 | | |
402 | | - | |
403 | | - | |
404 | | - | |
405 | | - | |
| 401 | + | |
| 402 | + | |
406 | 403 | | |
407 | 404 | | |
408 | 405 | | |
| |||
671 | 668 | | |
672 | 669 | | |
673 | 670 | | |
674 | | - | |
| 671 | + | |
675 | 672 | | |
676 | 673 | | |
677 | 674 | | |
| |||
697 | 694 | | |
698 | 695 | | |
699 | 696 | | |
700 | | - | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
701 | 700 | | |
702 | 701 | | |
703 | 702 | | |
| |||
712 | 711 | | |
713 | 712 | | |
714 | 713 | | |
715 | | - | |
716 | | - | |
| 714 | + | |
717 | 715 | | |
718 | | - | |
| 716 | + | |
719 | 717 | | |
720 | 718 | | |
721 | 719 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
177 | 177 | | |
178 | 178 | | |
179 | 179 | | |
180 | | - | |
| 180 | + | |
181 | 181 | | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
187 | 187 | | |
188 | 188 | | |
189 | 189 | | |
| |||
194 | 194 | | |
195 | 195 | | |
196 | 196 | | |
197 | | - | |
| 197 | + | |
198 | 198 | | |
199 | | - | |
200 | | - | |
| 199 | + | |
| 200 | + | |
201 | 201 | | |
202 | 202 | | |
203 | 203 | | |
| |||
Lines changed: 12 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
2474 | 2475 | | |
2475 | 2476 | | |
2476 | 2477 | | |
2477 | | - | |
2478 | | - | |
2479 | | - | |
2480 | | - | |
2481 | | - | |
2482 | | - | |
2483 | | - | |
2484 | | - | |
2485 | | - | |
| 2478 | + | |
| 2479 | + | |
| 2480 | + | |
| 2481 | + | |
| 2482 | + | |
| 2483 | + | |
| 2484 | + | |
| 2485 | + | |
| 2486 | + | |
| 2487 | + | |
| 2488 | + | |
2486 | 2489 | | |
2487 | 2490 | | |
2488 | 2491 | | |
| |||
0 commit comments