Make WordPress Core

Opened 11 years ago

Closed 11 years ago

#24245 closed enhancement (fixed)

Convert category__and query into category__in when only one category passed in

Reported by: batmoo's profile batmoo Owned by: wonderboymusic's profile wonderboymusic
Milestone: 3.7 Priority: normal
Severity: normal Version:
Component: Query Keywords: has-patch
Focuses: Cc:

Description

If a category__and query gets only one term passed in, it still builds out the complex query required for the AND lookup, which can be pretty expensive (#16706).

We should be smarter and automatically convert the query into a category__in when category__and only gets passed in one category.

Attachments (2)

24245.diff (1.7 KB) - added by wonderboymusic 11 years ago.
24245.2.diff (3.3 KB) - added by wonderboymusic 11 years ago.

Download all attachments as: .zip

Change History (4)

#1 @wonderboymusic
11 years ago

  • Keywords has-patch added
  • Milestone changed from Awaiting Review to 3.7

Mo, take a look and see if this patch accomplishes what you want, I think it does

#2 @wonderboymusic
11 years ago

  • Owner set to wonderboymusic
  • Resolution set to fixed
  • Status changed from new to closed

In 25238:

Convert category__and to category__in (less expensive) and unset it when only one category is passed. Adds unit tests.

Fixes #24245.

Note: See TracTickets for help on using tickets.