WordPress.org

Make WordPress Core

Opened 16 months ago

Last modified 3 months ago

#43446 reviewing enhancement

`meta_compare_key` should support more operators than `LIKE` and `=`

Reported by: boonebgorges Owned by: boonebgorges
Milestone: 5.3 Priority: normal
Severity: normal Version:
Component: Query Keywords: good-first-bug has-patch has-unit-tests needs-dev-note
Focuses: Cc:

Description

meta_compare_key was introduced in #42409. The default is = and it also supports LIKE. It could potentially support more options.

See https://core.trac.wordpress.org/ticket/42409#comment:4 and especially https://core.trac.wordpress.org/ticket/42409#comment:13 for some important considerations.

Attachments (5)

43446.1.diff (4.3 KB) - added by soulseekah 15 months ago.
!=, NOT LIKE, IN, NOT IN
43446.1.tests.diff (2.9 KB) - added by soulseekah 15 months ago.
Tests for !=, NOT LIKE, IN, NOT IN
43446.2.diff (5.2 KB) - added by soulseekah 15 months ago.
!=, NOT LIKE, IN, NOT IN, EXISTS, NOT EXISTS, REGEXP, NOT REGEXP, RLIKE
43446.2.tests.diff (6.0 KB) - added by soulseekah 15 months ago.
Tests for !=, NOT LIKE, IN, NOT IN, EXISTS, NOT EXISTS, REGEXP, NOT REGEXP, RLIKE
43446.2.doc.diff (3.2 KB) - added by soulseekah 15 months ago.
Docblock

Download all attachments as: .zip

Change History (12)

@soulseekah
15 months ago

!=, NOT LIKE, IN, NOT IN

@soulseekah
15 months ago

Tests for !=, NOT LIKE, IN, NOT IN

#1 @soulseekah
15 months ago

Started on this.

Implemented the following operators: !=, IN, NOT IN, NOT LIKE.

The numerical operators don't make too much sense, I think, since nobody names meta keys with pure numbers out there... I hope :)

I've marked EXISTS, NOT EXISTS (these are pretty much = and != operators as is, they can probably be aliased), RLIKE, REGEXP and NOT REGEXP for later, so just looking to get some eyes on what I have so far.

Special thanks to @versusbassz for working with me on this. He'll upload the modified docblock once all operators are covered.

Cheers.

@soulseekah
15 months ago

!=, NOT LIKE, IN, NOT IN, EXISTS, NOT EXISTS, REGEXP, NOT REGEXP, RLIKE

@soulseekah
15 months ago

Tests for !=, NOT LIKE, IN, NOT IN, EXISTS, NOT EXISTS, REGEXP, NOT REGEXP, RLIKE

#2 @soulseekah
15 months ago

  • Keywords has-patch has-unit-tests added; needs-patch removed

Added EXISTS, NOT EXISTS, REGEXP, NOT REGEXP, RLIKE implementations.

Docbloc changes incoming...

@soulseekah
15 months ago

Docblock

#3 @SergeyBiryukov
15 months ago

  • Milestone changed from Awaiting Review to 5.0
  • Owner set to soulseekah
  • Status changed from new to assigned

Assigning to mark the good-first-bug as "claimed."

#4 @pento
8 months ago

  • Milestone changed from 5.0 to 5.1

#5 @pento
5 months ago

  • Milestone changed from 5.1 to 5.2

Patches need review.

#6 @desrosj
3 months ago

  • Keywords needs-dev-note added

Latest patch still applies cleanly and needs the @since tags updated.

@boonebgorges are you able to review this in time for 5.2?

Also, marking as needs-dev-note so one can be drafted once the change is merged.

#7 @boonebgorges
3 months ago

  • Milestone changed from 5.2 to 5.3
  • Owner changed from soulseekah to boonebgorges
  • Status changed from assigned to reviewing

Sorry for missing this when the patches came in. I don't have time to review for the 5.2 deadline, but I'll take a look for 5.3.

Note: See TracTickets for help on using tickets.