Changes between Initial Version and Version 1 of Ticket #41796, comment 9
- Timestamp:
- 09/15/2017 03:03:27 AM (8 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #41796, comment 9
initial v1 9 9 The last option seems like the best, but it is not straightforward. The naive solution: When `number` accompanies `object_ids`, don't add the `LIMIT` clause; Fetch all results, and trim down to `number` in PHP. This is going to kill sites like wordpress.org in a different way (instead of `DISTINCT`, it'll be the 500,000 tags in memory). 10 10 11 A more complicated PHP solution is to use the `LIMIT` logic, and then to detect in PHP when the returned and deduped results are less than `number`. If so, recursively requery for `$number - 12 count( $results )`. Eg: `number=10`; deduping from `object_ids` gives you 8; `WP_Term_Query` requeries `number=2&offset=8` and appends the results; etc until we have 10. This is likely to be very complicated. 11 A more complicated PHP solution is to use the `LIMIT` logic, and then to detect in PHP when the returned and deduped results are less than `number`. If so, recursively requery for {{{$number - count( $results )}}}. Eg: `number=10`; deduping from `object_ids` gives you 8; `WP_Term_Query` requeries `number=2&offset=8` and appends the results; etc until we have 10. This is likely to be very complicated. 13 12 14 13 If anyone has good ideas, please share them. Otherwise I think we might go with option 2 (the status quo).