[wp-trac] [WordPress Trac] #53450: [WP_Meta_Query] Add faster LIKE based 'STARTSWITH' and 'ENDSWITH' compare modes for value query

WordPress Trac noreply at wordpress.org
Mon Sep 6 18:24:08 UTC 2021


#53450: [WP_Meta_Query] Add faster LIKE based 'STARTSWITH' and 'ENDSWITH' compare
modes for value query
-------------------------------------------------+-------------------------
 Reporter:  janthiel                             |       Owner:  (none)
     Type:  enhancement                          |      Status:  new
 Priority:  normal                               |   Milestone:  Awaiting
                                                 |  Review
Component:  Query                                |     Version:  5.7.2
 Severity:  trivial                              |  Resolution:
 Keywords:  dev-feedback has-patch needs-docs    |     Focuses:
  needs-codex has-unit-tests                     |  performance
-------------------------------------------------+-------------------------

Comment (by janthiel):

 Replying to [comment:14 manzwebdesigns]:
 > The only suggestion I would make is to make the following changes,
 moving 'contains' to the beginning of the list of accepted options:
 > {{{
 > @type string $compare_key_like_mode  Search mode for LIKE compares.
 Accepts 'contains', 'startswith ' or
 >                                      'endswith'. Default is 'contains'.
 > @type string $compare_like_mode      Search mode for LIKE compares.
 Accepts 'contains', 'startswith ' or
 >                                      'endswith'. Default is 'contains'.
 > }}}

 Hi @manzwebdesigns Thank you very much for your input. Could you be so
 kind and explain to me ''why'' you propose this change?
 I didn't spend much thinking about the order of the comment till now :-)
 Yet when considering it, all orders are kind of reasonable. Alphabetical
 would be as well as a "logical" order where "contains" would be between
 "startsWith" and "endsWith". My current implementation groups "...with"
 and closes with "contains". So it is kind of similar to your suggestion.
 Just reversed.

 Just curious.

 Thanks, Jan :-)

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/53450#comment:15>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list