Opened 15 years ago
Closed 11 years ago
#11823 closed enhancement (fixed)
Improve SQL query used by get_terms()
Reported by: | sirzooro | Owned by: | filosofo |
---|---|---|---|
Milestone: | 3.7 | Priority: | normal |
Severity: | normal | Version: | 3.0 |
Component: | Taxonomy | Keywords: | has-patch |
Focuses: | Cc: |
Description
#11076 / [12658] changes get_terms()
so it uses SQL query with multiple conditions in WHERE clause - one for each included / excluded term. It will be better to change generated SQL from:
AND (t.term_id = 1 OR t.term_id = 2 OR ...) AND (t.term_id <> 1 AND t.term_id <> 2 AND ...)
to:
AND t.term_id IN (1, 2, ...) AND t.term_id NOT IN (1, 2, ...)
Attachments (6)
Change History (17)
#4
@
14 years ago
instead of those ugly loops, something similar to this might be possible?
$interms = array_map('intval', $interms); $inclusions = ' AND t.term_id IN ( ' . implode(',', $interms) . ' )';
(note, Untested, and havnt looked at the code closer than the patch)
#5
@
11 years ago
- Milestone changed from Future Release to 3.7
Refreshed, we should be using IN
and NOT IN
in most of these old functions that accept arrays of IDs
#6
@
11 years ago
11823.2.diff fixes a bug in the exclude_tree
handling (the current patch will only exclude the last tree in the array).
#10
@
11 years ago
- Keywords commit removed
- Resolution fixed deleted
- Status changed from closed to reopened
[25162] causes a database error if an include or exclude argument is not empty, but is also not really a term id. 11823.4.diff addresses that.
Version 0, edited 11 years ago
by
(next)
Note: See
TracTickets for help on using
tickets.
OK, looks that I have to provide a patch for this :)