perf(2meet-data-optimizer): keep WordPress's split query on routed searches

- posts_request only drops SQL_CALC_FOUND_ROWS, but WordPress then treated the request as filtered and selected full post rows through a temporary table; split_the_query now keeps the ID-first split for routed searches when nothing else changed the request, and posts_request_ids drops SQL_CALC_FOUND_ROWS from the split ID query
- Verify: tests/live/run.php router (12/12, IDs-first request, found_posts == native); dev36 fe.sh price 589→340 ms, price__asc 961→427 ms, rating__desc 1724→872 ms, hourly_rate__desc 855→884 ms (was 1206)
- PR: PR-062b
This commit is contained in:
2026-09-26 20:14:29 +08:00
parent ec75721976
commit aa2da274dd
4 changed files with 131 additions and 7 deletions
+1
View File
@@ -418,6 +418,7 @@ if ( ! function_exists( 'wp_cache_delete' ) ) { function wp_cache_delete( $key,
if ( ! class_exists( 'WP_Query' ) ) {
class WP_Query {
public string $request = '';
private array $vars = [];
public function get( string $key, $default = '' ) { return $this->vars[ $key ] ?? $default; }
public function set( string $key, $value ): void { $this->vars[ $key ] = $value; }