WordPress.org

Make WordPress Core

Opened 4 months ago

Last modified 4 months ago

#43446 assigned enhancement

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

Reported by: boonebgorges Owned by: soulseekah
Milestone: 5.0 Priority: normal
Severity: normal Version:
Component: Query Keywords: good-first-bug has-patch has-unit-tests
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 4 months ago.
!=, NOT LIKE, IN, NOT IN
43446.1.tests.diff (2.9 KB) - added by soulseekah 4 months ago.
Tests for !=, NOT LIKE, IN, NOT IN
43446.2.diff (5.2 KB) - added by soulseekah 4 months ago.
!=, NOT LIKE, IN, NOT IN, EXISTS, NOT EXISTS, REGEXP, NOT REGEXP, RLIKE
43446.2.tests.diff (6.0 KB) - added by soulseekah 4 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 4 months ago.
Docblock

Download all attachments as: .zip

Change History (8)

@soulseekah
4 months ago

!=, NOT LIKE, IN, NOT IN

@soulseekah
4 months ago

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

#1 @soulseekah
4 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
4 months ago

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

@soulseekah
4 months ago

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

#2 @soulseekah
4 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
4 months ago

Docblock

#3 @SergeyBiryukov
4 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."

Note: See TracTickets for help on using tickets.