You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I do a values_list("field", flat=True) of a MultiValueField, populated with a list in a prepare_FOO method, it doesn't return like django, a unique list like [ x, y, z ...] but a list of lists like: [ [x,y,z], [x,y,z] ].
I don't know if you did this for some design purposes. But in my opinion, considering that .distinct() in haystack isn't supported, at least I could have/decide the correct format.
The problem for me exists because I've implemented a simple form of distinct, for values_list values using sets, and this format breaks all sets internal library automatisms, like erasing duplicated values.
To make this work I had to extend ValuesListSearchQuerySet ( That's not simple ) and I had to modify it's internal post_process_method to make this work even with values that are lists.
Finally keep on really good application.
The text was updated successfully, but these errors were encountered:
If you used Django's values_list on a multi-valued field, you would get the same list of lists. It's just that multivalued fields are not that common in standard SQL DBs. Try PostgreSQL arrays and you'll see. The idea with values_list is that you can specify more than one field and when flat=False you'll get list of field value lists, while with flat=True and only one field specified it's just one list. So use itertools chain or smth similar for your application. Marking this as wontfix and closing.
When I do a values_list("field", flat=True) of a MultiValueField, populated with a list in a prepare_FOO method, it doesn't return like django, a unique list like [ x, y, z ...] but a list of lists like: [ [x,y,z], [x,y,z] ].
I don't know if you did this for some design purposes. But in my opinion, considering that .distinct() in haystack isn't supported, at least I could have/decide the correct format.
The problem for me exists because I've implemented a simple form of distinct, for values_list values using sets, and this format breaks all sets internal library automatisms, like erasing duplicated values.
To make this work I had to extend ValuesListSearchQuerySet ( That's not simple ) and I had to modify it's internal post_process_method to make this work even with values that are lists.
Finally keep on really good application.
The text was updated successfully, but these errors were encountered: