Automattic\WooCommerce\Internal\DataStores\Orders
CustomOrdersTableController::recreate_order_address_fts_index
Recreate order addresses FTS index. Useful when updating to 9.4 when phone number was added to index, or when other recreating index is needed.
Method of the class: CustomOrdersTableController{}
No Hooks.
Returns
Array. Array with keys status (bool) and message (string).
Usage
$CustomOrdersTableController = new CustomOrdersTableController(); $CustomOrdersTableController->recreate_order_address_fts_index(): array;
Changelog
| Since 9.4.0. | Introduced. |
CustomOrdersTableController::recreate_order_address_fts_index() CustomOrdersTableController::recreate order address fts index code WC 10.7.0
public function recreate_order_address_fts_index(): array {
$this->db_util->drop_fts_index_order_address_table();
if ( $this->db_util->fts_index_on_order_address_table_exists() ) {
return array(
'status' => false,
'message' => __( 'Failed to modify existing FTS index. Please go to WooCommerce > Status > Tools and run the "Re-create Order Address FTS index" tool.', 'woocommerce' ),
);
} else {
update_option( self::HPOS_FTS_ADDRESS_INDEX_CREATED_OPTION, 'no', false );
}
$this->db_util->create_fts_index_order_address_table();
if ( ! $this->db_util->fts_index_on_order_address_table_exists() ) {
return array(
'status' => false,
'message' => __( 'Failed to create FTS index on order address table. Please go to WooCommerce > Status > Tools and run the "Re-create Order Address FTS index" tool.', 'woocommerce' ),
);
} else {
update_option( self::HPOS_FTS_ADDRESS_INDEX_CREATED_OPTION, 'yes', false );
return array(
'status' => true,
'message' => __( 'FTS index recreated.', 'woocommerce' ),
);
}
}