We are excited to announce availability of Full-Text Search (FTS) indexes in experimental mode starting with WooCommerce 9.0, to be released June 11, 2024. In HPOS, we moved order addresses to a separate table, and now, we support adding full-text search indexes to order addresses and order products.
When enabled, all the order searches will be automatically redirected to full-text search indexes. Additionally, we have also made the non-FTS search faster when using HPOS.
Benchmarking
In our internal testing, this index has been quite promising. On a test site on WordPress.com’s $25/month plan with 500k orders and 30k products, (numbers are the average of the total time taken by search queries across 5 requests):
Search | WooCommerce 8.9 | WooCommerce 9.0 | WooCommerce 9.0 with Full-text indexes |
All (no results) | 3261ms | 1904ms | 676ms |
All (3k+ results) | 6679ms | 3070ms | 547ms |
Customers (no results) | 1049ms | 1033ms | 0.6ms |
Customers (3k+ results) | 2111ms | 2119ms | 40ms |
Products (no results) | 1897ms | 781ms | 0.6ms |
Products (3k+ results) | 3715ms | 1507ms | 53ms |
Benchmarking of WooCommerce order search
Known Quirks
We’re labeling MySQL’s FTS index search as experimental for now, as it is a relatively new addition that is not yet extensively documented for the WooCommerce ecosystem. Our goal is to make it stable and automatically available for stores using HPOS in a future update once we have addressed some of the following quirks present in the system today:
- Inconsistency in search/tokenization: The FTS index works by tokenizing the content based on token size as defined by several MySQL config params (innodb_ft_min_token_size, innodb_ft_max_token_size, etc). Right now, we are not specifying any param in our implementation, which means it will use whatever is the configured default for the shop. This may induce inconsistencies such as minimum character length (default 3), token-only search, etc. We plan to settle on the configuration that will work for most shops while the feature is in experimental mode.
- Server support: While the FTS indexes are supported from MySQL 5.0+ onwards, we found in our testing that they didn’t work for versions from 8.0.29 to 8.0.35. We expect some other inconsistencies across the version range and MariaDB implementation.
- n-gram configuration: We are currently using the built-in language parser instead of the dedicated n-gram parser, which may support more comprehensive search at the cost of more space. However, if the default parser does not work as expected, we plan to switch to the n-gram implementation.
Enabling the feature
To enable the feature, make sure you have WooCommerce 9.0 or enabled. Use the WooCommerce Beta Tester plugin or download the latest beta release from WordPress.org to get the current beta for WooCommerce 9.0.
Next, go to WooCommerce > Settings > Advanced > Features and enable the HPOS Full-text search indexes option. Note that this feature only works when Order data storage is set to HPOS. This setting is also forward compatible, so you can disable/enable it as needed:
Feedback
We highly recommend testing out this feature on your staging environment. We’ve kicked off a GitHub Discussion for this topic, and we look forward to learning about your experience with this feature and any feedback you share with us.
Leave a Reply