Changes between Version 3 and Version 4 of Ticket #16609
- Timestamp:
- Aug 11, 2011, 5:15:17 PM (13 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #16609 – Description
v3 v4 1 1 I believe this has already been touched upon in #15819, however the consensus (comment ticket:15819#comment:13) was 2 2 3 "For people in situations where .distinct() is broken for whatever reason, the workaround here is simple: don't use search_fieldswith relations in a way that triggers it."3 "For people in situations where `.distinct()` is broken for whatever reason, the workaround here is simple: don't use `search_fields` with relations in a way that triggers it." 4 4 5 5 I couldn't find a ticket for this, so here it is. 6 6 7 In my case, I am searching for a keyword which is found in a search_fields item that isn't traversing M2M. When search_fieldsalso contains a M2M traversal, I get duplicate results.7 In my case, I am searching for a keyword which is found in a `search_fields` item that isn't traversing M2M. When `search_fields` also contains a M2M traversal, I get duplicate results. 8 8 9 In my case - this might be relevant or not - I am traversing a ForeignKey first and then an M2M field in that problematic search_fields entry, e.g:9 In my case - this might be relevant or not - I am traversing a !ForeignKey first and then an M2M field in that problematic search_fields entry, e.g: 10 10 11 11 {{{ … … 13 13 }}} 14 14 15 This happens even though the string is not matched by fkmodel__m2mmodel__name, only by id.15 This happens even though the string is not matched by `fkmodel__m2mmodel__name`, only by `id`. 16 16 17 17 This might not be clear, this is what the model relations look like: … … 21 21 }}} 22 22 23 M2MModel contains the name field that I have specified in search_fields.23 M2MModel contains the name field that I have specified in `search_fields`. 24 24 25 25 This might or might not be related to #15559.