perf(2meet-data-optimizer-hivepress-addon): (column, post_id) indexes for the listing sorts HivePress offers

- hp_listing_core declares (hp_price, post_id), (hp_rating, post_id) and
  (hp_hourly_rate, post_id): with core 1.4.0 a flat-first price, rating or
  hourly-rate sort reads them in order instead of sorting every match
  (dev36 stage 3: the price-range + price-sort search was the slowest routed
  page, 2.9 s at 1.3M listings); core 1.3.0 ignores indexes ending with post_id
- the pinned schema hash is unchanged (indexes are not part of it)
- Verify: HivePressEntityGroupsTest, unit 148, integration 53, phpcs;
  dev36 front-end sorts
- PR: PR-119
This commit is contained in:
2026-09-27 22:41:46 +08:00
parent d802bf0145
commit 0cd2a9db5b
2 changed files with 22 additions and 7 deletions
@@ -266,8 +266,13 @@ final class TMDO_HivePress_Entity_Groups {
// Only with core 1.3.0+ (ddl_allowed()): older cores run the ALTER
// inside whatever request comes first, a visitor's included.
'indexes' => method_exists( 'TMDO_Schema_Manager', 'ddl_allowed' ) ? array(
'hourly_rate' => array( 'hp_hourly_rate' ),
'rating_count' => array( 'hp_rating_count' ),
'hourly_rate' => array( 'hp_hourly_rate' ),
'rating_count' => array( 'hp_rating_count' ),
// HivePress sorts: the value then the ID tie-break, which core 1.4.0
// reads in order (flat-first) instead of sorting every match.
'price_id' => array( 'hp_price', 'post_id' ),
'rating_id' => array( 'hp_rating', 'post_id' ),
'hourly_rate_id' => array( 'hp_hourly_rate', 'post_id' ),
) : array(),
)
);