[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
Fri Jul 15 00:49:56 UTC 2022


#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:  6.1
Component:  Query                                |     Version:
 Severity:  trivial                              |  Resolution:
 Keywords:  dev-feedback has-patch needs-docs    |     Focuses:
  needs-codex has-unit-tests early early-like-   |  performance
  actually-early needs-testing needs-refresh     |
-------------------------------------------------+-------------------------

Comment (by SergeyBiryukov):

 Hi there, thanks for the ticket!

 This was discussed in a
 [https://wordpress.slack.com/archives/C02RQBWTW/p1657830489661469
 6.1-early bug scrub] on WordPress Slack with @hellofromTonya, @audrasjb,
 and @mark. Some of the initial feedback:
 * The ticket needs a strategy to help it move forward including a testing
 strategy to validate it works and discover potential unknowns.
 * As this is about performance, benchmarking will also be needed.

 Replying to [ticket:53450 janthiel]:
 > As an alternative I thought about reworking the current LIKE mode to
 allow custom wildcard passing. But this will clearly break backward compat
 and thus I discarded this approach.

 There was some consensus in the chat that this approach should be explored
 further, allowing people to place the `%` in the value as they wish.
 Laravel does it like that:
 {{{
 ->where('column', 'like', 'sometext%')
 }}}
 The backward compatibility concerns can be reviewed to see if they can be
 mitigated, perhaps via a way to mark up values as raw.

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


More information about the wp-trac mailing list