Commit b997389
committed
fix: correctly implement field projection with return_fields
- Move RETURN clause from query string to args list (fixes RediSearch syntax)
- Rename internal parameter from return_fields to projected_fields to avoid conflict with method name
- Return dictionaries instead of model instances when using field projection
- Add proper parsing for projected results that returns flat key-value pairs
- Add tests for both HashModel and JsonModel field projection
- Update validation to use model_fields instead of deprecated __fields__
This addresses all review comments from PR #633 and implements field projection correctly.1 parent 5af2e8e commit b997389
File tree
3 files changed
+78
-20
lines changed- aredis_om/model
- tests
3 files changed
+78
-20
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
418 | 418 | | |
419 | 419 | | |
420 | 420 | | |
421 | | - | |
| 421 | + | |
422 | 422 | | |
423 | 423 | | |
424 | 424 | | |
| |||
443 | 443 | | |
444 | 444 | | |
445 | 445 | | |
446 | | - | |
447 | | - | |
| 446 | + | |
| 447 | + | |
448 | 448 | | |
449 | | - | |
| 449 | + | |
450 | 450 | | |
451 | 451 | | |
452 | 452 | | |
| |||
505 | 505 | | |
506 | 506 | | |
507 | 507 | | |
508 | | - | |
509 | | - | |
| 508 | + | |
510 | 509 | | |
511 | 510 | | |
512 | | - | |
513 | | - | |
514 | | - | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
515 | 514 | | |
516 | 515 | | |
517 | 516 | | |
518 | 517 | | |
519 | | - | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
520 | 547 | | |
521 | 548 | | |
522 | 549 | | |
| |||
899 | 926 | | |
900 | 927 | | |
901 | 928 | | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
902 | 935 | | |
903 | 936 | | |
904 | 937 | | |
| |||
912 | 945 | | |
913 | 946 | | |
914 | 947 | | |
915 | | - | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
916 | 954 | | |
917 | 955 | | |
918 | 956 | | |
| |||
966 | 1004 | | |
967 | 1005 | | |
968 | 1006 | | |
969 | | - | |
| 1007 | + | |
970 | 1008 | | |
971 | 1009 | | |
972 | 1010 | | |
973 | | - | |
| 1011 | + | |
974 | 1012 | | |
975 | 1013 | | |
976 | 1014 | | |
| |||
1546 | 1584 | | |
1547 | 1585 | | |
1548 | 1586 | | |
1549 | | - | |
1550 | | - | |
1551 | | - | |
| 1587 | + | |
1552 | 1588 | | |
1553 | 1589 | | |
1554 | 1590 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1133 | 1133 | | |
1134 | 1134 | | |
1135 | 1135 | | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
1136 | 1153 | | |
1137 | 1154 | | |
1138 | 1155 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
955 | 955 | | |
956 | 956 | | |
957 | 957 | | |
| 958 | + | |
958 | 959 | | |
959 | 960 | | |
960 | 961 | | |
961 | | - | |
962 | | - | |
963 | | - | |
964 | | - | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
965 | 970 | | |
966 | 971 | | |
967 | 972 | | |
| |||
0 commit comments