=== Super Speedy Search === Contributors: dhilditch Donate link: https://www.wpintense.com/ Tags: speed, performance Requires at least: 4.7 Tested up to: 5.8.2 Stable tag: 5.17 Requires PHP: 7.0 License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html Instant as-you-type search using native WordPress tech. == Description == Instant as-you-type search using native WordPress tech. == Frequently Asked Questions == = Is this PHP 8 compatible? = Yes, and it's MySQL 8 and MariaDB compatible too. == Changelog == = 5.28 (11th March 2025) = * Hotfix for order search, added search by order id broke text search for orders = 5.27 (11th March 2025) = * Added aria-label to search form, uses placeholder text, if none used, defaults to 'Search' translated based on your localisation files = 5.26 (10th March 2025) = * Added new "Search by Order ID" test * Fixed broken search by order id functionality = 5.25 (6th March 2025) = * Fixed usermeta search, includes fixing lastname search = 5.24 (5th March 2025) = * Added cli tests to help diagnose issues on client sites in future * Fixed issue with how HPOS order search was returning data so that full HPOS search works properly now = 5.23 (21st February 2025) = * Improved condition for when admin CSS loads * Added new define('SSS_SEARCH_ACTION', '/'); // you can change this to /shop/ or whatever else to change the search base url = 5.22 (18th February 2025) = * Added primary keys to all of our staging tables - these are not really needed for staging/import tables, but some hosts barf if you don't have PKs = 5.21 (18th February 2025) = * Added fulltext index for HPOS order tables * Added new filters to handle order search override for HPOS - order search is fast again! * Updated DB version - a table rebuild is required to apply the new index = 5.20 (8th February 2025) = * Fix for Elementor FSE editor - our query string parser to redirect ultra ajax posts was interfering with their visual editor = 5.19 (3rd December 2024) = * Update to avoid SSS being used by WooCommerce Bulk Variations plugin which astoundingly 'searches' for product variations on the product detail page, even though these variations are all listed in the parent product = 5.18 (27th November 2024) = * Fix for new settings to clear the local transient cache when the license key is changed * Added a new 'recheck now' button on the license key page for when users renew or upgrade = 5.17 (26th November 2024) = * Updated to use new version of license checker * Moved settings page to under the Super Speedy menu slug * Added link to settings page in plugins list = 5.16 (20th November 2024) = * Downgraded SHOW FULL PROCESSLIST to just SHOW PROCESSLIST so WP DB users don't need process privilege = 5.15 (19th November 2024) = * Minor fix to hide the extra TranslatePress config stuff unless TranslatePress active = 5.14 (19th November 2024) = * Added some extra code for TranslatePress users where they have migrated in the past and ended up with incompatible collations or charsets in their Database - The plugin highlights the differences and provides SQL to fix the collation and charset differences - test on DEV! = 5.13 (15th November 2024) = * Added TranslatePress compatibility - table rebuild required * Added new Default Placeholder option to wp-admin > Search > Main tab = 5.12 (15th November 2024) = * Fixed date formatting for ultra ajax list mode * Altered wp-admin woo product search so admins search for everything except trash, rather than specific post statuses - also fixed it so if you switch to trash, you can search the trash = 5.11 (12th November 2024) = * Added date formatting option for Ultra Ajax output = 5.10 (8th November 2024) = * Fixed issue when searching for "{x} s" where a bug was causing to appear in the suggestions * Removed a bunch of debug output from the JS console = 5.09 (30th October 2024) = * Fix for Edit Product option 'hide from catalog' in ajax search results - non WooCommerce items are unaffected = 5.08 (29th October 2024) = * Fixed pagination issue on search results page - it was working if you had Scalability Pro Remove SQL_CALC_FOUND_ROWS enabled - but without it, with the previous new optimisations it was not calculating total pages - total page counts are back now, and faster than ever = 5.07 (23nd October 2024) = * Removed excess logging to the error log = 5.06 (22nd October 2024) = * Improved compatibility with TranslatePress slightly - build process still needs to be modified for complete compatibility = 5.05 (18th October 2024) = * Hotfix for cross-sell, up-sell, 'whatever' ajax product search from edit product pages = 5.04 (18th October 2024) = * Hotfix for table collation not being respected = 5.03 (16th October 2024) = * Hotfix for wp-admin product search, had hardcoded wp_ table prefix :( = 5.02 (16th October 2024) = * Hotfix for versions of MySQL which do not like variable assignment inside a query = 5.01 (15th October 2024) = * Fixed bug with "exact searches" with new structure = 5.00 (13th October 2024) = * Optimized the rebuild so that it does a few things in one table scan rather than multiple table scans - this also eliminates the need to run an optimize table command * Also sped up how long the first real part of the build takes - this part is the only part which references live WP tables, so the shorter those are in use the better - e.g. on foundthru now (1 million products), this first step takes 5 minutes meaning I cannot insert to wp_posts for 5 minutes - no big hardship - previously it was 20 minutes - now the whole search rebuild on foundthru takes 20 minutes total, previously 40 minutes (excluding suggestions rebuild) = 4.99 (13th October 2024) = * Fixed wp-admin bar so it shows SSS Active correctly * Refactored form generation code so there is only one piece of code that generates the search form * Removed scrolllock for fixed position overlay * Refactored shortcode PHP * Updated post_status to only include 'inherit' if an attachment post type is included in the search = 4.98 (12th October 2024) = * Fixed cancel button properly so it completely cancels * Added GUID to fulltext check for tickmark on Main tab (needed for filename search) = 4.97 (12th October 2024) = * Re-worked how the SQL Build operates to handle short tokens and tokens containing punctuation - brings speed back to excellent levels, build speed had become slow * Fixed bug in 'search this page' feature which was causing it to still search a page on a single, not just archives - also, this was being enabled by default! (all versions > 4.85 were dev versions though) = 4.96 (9th October 2024) = * Fixed exact searches so that, e.g. a search for 'os' will only match whole words - this affects synonyms, e.g. if you have: os, operating system then 'os' will now have to be an exact whole word match * Added partial matches to meta columns and post_title - e.g. if you have 000-XYZ-1234 you can search for xyz-1234 or even just 1234 to find this item. - for these partial matches to work, there must be a non-alphanumeric separator, e.g searching for 1234 against 000-xyz1234 will find nothing - I'm thinking for admin searches when nothing found, to give a button to perform a slow search and search within the string * Improved media search - fixed fulltext search so it actually works for media search - now, similarly to meta values and titles, you can search for parts of the filename to find matches too * Fixed compatibility with WP Sheet Editor - it was just a cautious hook not running unless it was on the product admin/search screen * Fixed 'Search current page' widget option - it was ignoring URL parameters - also tidied up the double slash // = 4.94 (5th October 2024) = * Changed REGEXP_REPLACE code to by MySQL 8 compatible - did not realise it was MariaDB only to be able to replace backreferences = 4.93 (5th October 2024) = * Fixed bug in new faster code breaking orderby * Fixed exact search containing short tokens = 4.92 (4th October 2024) = * Fixed new synonym code so that it works perfectly with the new short-token code and items with non-alpha-numeric characters inside them * Fixed exact search so that it forces the words to have to be next to each other * Fixed synonym search so that if you use a combination of long and short tokens (>=3 or < 3 chars) then the search will work! * Fixed short token weights so they get ranked properly * Fixed synonyms when there are multiple synonym matches so that it performs correct fulltext {any of these} AND {any of these} * Fulltext synonyms made to be exact match when >= 3 characters = 4.91 (4th October 2024) = * Added fallback redirect handler for sites that do not gracefully handle ?p=x - our Ultra ajax does not have access to the get_permalink function, so it generates URLs like ?p=x - these are fine normally since they normally redirect to the pretty permalink and they are not indexed by google - client site had 404 handler implmented which prevented their redirects from occurring, so I've added a parse_request handler which runs if ?p is set and is the only item set = 4.90 (2nd October 2024) = * Added forced ordering of search results * Improved onboarding messaging and added links to KB guides if 502 gateway error occurs during table build = 4.89 (30th September 2024) = * Fixed bug introduced in dev for page 2+ = 4.88 (26th September 2024) = * Fixed wp-admin product search so it respects the meta keys configured - fixes SKU search in particular on wp-admin > Products - maybe we want to have separate config for meta keys searchable front-end vs back-end? * Improved SKU search (and other post meta) so that if you have entries like XYZ/ABC they will be searchable in full, but also you could search ABC and find them. * Fixed synonym search to work perfectly with new tokenized search * Added mid-SKU search functionality - if you have punctuation in the middle of your SKUs (or other postmeta) these can now be matched - e.g search ABC against an SKU of 012-ABC will match * Fixed up weights so they don't continue displaying in footer nav areas and fixed them so they work with all the new fast code * Added CSS and JS for new popover search panel option = 4.87 (23rd September 2024) = * Improved wp-admin Product Search - was breaking if a product variation matched the search and the table left empty gaps, or in some cases a fatal error (Elementor) - Reworked how the product search override works to avoid the ->pluck warnings - This also happens to fix an SKU bug that was reported * Fixed a bug with product visibility checks - it was possible for out of stock items to appear in results even if Woo was configured to not show out of stock in search results * Added a static function cache for our checks for columns and indexes existing to remove duplicate queries (#208) * Fixed collation error that can happen for suggestions building * Vastly improved short token search speed and accuracy = 4.86 (19th September 2024) = * Fixed warning from our Ultra-ajax mu-plugin * Reworked how manually added/removed suggestions work - a table rebuild is required if you have used these in the past - any manually added suggestions will allow users to search *within* those words, ideally keep to < 1000 manually added for speed - also be aware that this means those suggestions will regularly be appearing at the top - useful if you want to highlight popular things to search on your site * Vastly improved the speed of short-token search - short tokens are < 3 characters, not including punctuation, e.g. a search for "m.2 wi-fi" involves 4 short tokens: m, 2, wi and fi - Previously, these were having wildcards added e.g. it was searching for matches starting with m, starting with 2, starting with wi and starting with fi - now these short tokens must match the whole words, so any short tokens added MUST be present in order for a match to be made - this vastly improves SKU searches too, especially the likes of AB-12-93 type SKUs where the parts are all short tokens. * Reworked how EXACT search works - anything surrounded by "quotes" in the search string will now properly be treated as an exact search - any other tokens which contain 'word separators' will be treated as an exact search, e.g. wi-fi gets turned into "wi-fi" rather than searching for wi fi = 4.85 (14th September 2024) = * Fixed issue that came up with short token searches e.g. wi-fi was failing (if no long tokens existed) = 4.84 (13th September 2024) = * #179 - Short token multiplier not working for super speedy search - Short token boost matching exact whole word in the title - there's a new definition you can use to boost or reduce this define( 'SSS_SHORT_TOKEN_WEIGHT_MULTIPLIER', 50 ); - it's also configurable in the advanced dev section - this boosts any items which match searched for short tokens, e.g. search for "wi-fi 6" would give 3 short token boosts * Improved synonym search - refactored code to give a single function for dealing with tokenization for the full text engine - used refactored code in fixing synonym search so that searches work as expected - fixed issue in code where if a special character was contained inside a space-separated token then this item was added to exact search matches, it was adding even if the item had been a synonym - that meant that a search for "t-shirt" was demanding that exactly "t-shirt" appear and not "tshirt" or "t shirt" if defined like that in the synonyms - this also fixes synonyms for e.g. wi-fi to wifi, or m.2 matching to nvme or m2 etc * Fixed meta search weights - they were not being properly applied * Cleaned up some other minor stuff = 4.83 (12th September 2024) = * Fixed collation table build issue - seems at some point in the code the table rebuild got the collations hard coded again rather than pulled from $wpdb defaults = 4.82 (10th September 2024) = * Fixed JS warning that was appearing in console from new search button option = 4.81 (29th August 2024) = * Improved styling for speech bubble * Added bumper to speech bubble at left hand side so it doesn't go off screen * Added remaining JS tweaks to make everything closable easily = 4.80 (29th August 2024) = * Added auto textbox focus when users click any of the new popover buttons to reveal the search bar * Fixed some warnings from our JS on some wp-admin pages = 4.79 (28th August 2024) = * Fixed error in table build related to woo order items search = 4.78 (27th August 2024) = * Fixed used of global $SSS and used its function to retrieve options so we avoid any missing option warnings appearing ever again - fixed in multiple places to avoid these warnings * Removed old unused code * Added new display style to shortcode only - will be added to widget once I'm more comfortable with this - lets you choose to display just the magnifying glass, then a popover will appear when clicking = 4.77 (9th August 2024) = * #176 - solved advanced features being overwritten completely if one is set in wp-config and then settings are saved = 4.76 (25th July 2024) = * Reverted changes made in https://github.com/superspeedyplugins/issue-tracker/issues/117 for the advanced options - if you set one option in your wp-config, it was greying out all the other options after it - if you then saved settings, these other greyed out options were being saved as unchecked - for now, i've disabled access to those advanced options through the interface and re-added all the definitions to the defines.php file to fix this issue immediately = 4.75 (24th July 2024) = * Fix for non-woo sites - was trying to create an index to improve woo order search but was not checking for existence of table first = 4.75 (15th July 2024) = * #167 - Add regular (weekly default) rebuild option for SSS tables https://github.com/superspeedyplugins/issue-tracker/issues/167 = 4.74 (23rd July 2024) = * Fixed @petar777 reported issue with JS error on scroll = 4.73 (23rd July 2024) = * Fixed issue with "SSS_MAX_PER_TAX & SSS_SHORT_TOKEN_WEIGHT_MULTIPLIER" in advanced tab as checkbox, changed to input field. = 4.73 (23rd July 2024) = * Updated JS for license checker - it had been affecting wp-admin overlays which heavily use JS to manipulate the DOM = 4.72 (17th July 2024) = * Fixed issue with ordering by title and other orderings, both for ordering coming from URL and default settings = 4.71 (11th July 2024) = * Fixed warning on plugins page caused by new settings upgrade * Added better messaging for invalid, expired and exceeded licenses = 4.70 (11th July 2024) = * #168 - Wrap the SSS advanced options in a hidden div, revealable only with a JS click https://github.com/superspeedyplugins/issue-tracker/issues/168 = 4.69 (10th July 2024) = * Hotfix for settings upgrade from yesterday = 4.68 (9th July 2024) = * Updated license checker to use new faster version = 4.67 (12th June 2024) = * #138 - Problem with slash "/" in search https://github.com/superspeedyplugins/issue-tracker/issues/138 * Added background code for Customization tab and Advanced Features = 4.66 (12th June 2024) = * Happy Birthday to me! * Fixed critical error occurring on some sites when searching category results pages, depended on ordering defined * Added back in the old option to the shortcode and widget to let users choose to 'refine' their search rather than start from scratch - option in shortcode is called search_what with everything/current/current_product_cat all being viable current options = 4.66 (23rd May 2024) = * #117 - removed all unused defines and moved the ones being used in advanced tab. https://github.com/superspeedyplugins/issue-tracker/issues/117 = 4.66 (9th July 2024) = * Updated license checker to use new faster version = 4.65 (7th June 2024) = * Found and fixed a bug caused by fix for 'subfolder' installs of WordPress - this was causing our ultra ajax to break and thus search speed to be slower - all fixed now * Found and fixed a bug in the code for #145 related to checking 'search visibility' vs 'catalog visibility' - removed the use of a function which is unavailable in ultra ajax - updated the code in the initial table build and table maintenance to respect exclude-from-search instead of exclude-from-catalog = 4.64 (6th June 2024) = * #145 - Fixed an issue where 'shop only' and 'search results only' were actually reversed in functionalit - If I edit a product and choose 'SHOP ONLY' it still appears in search results of SSS https://github.com/superspeedyplugins/issue-tracker/issues/145 = 4.63 (4th June 2024) = * Removed a couple of unused options from the settings pages = 4.62 (23rd May 2024) = * #127 - Fixed SSS Not Active appears on EVERY wp-admin page https://github.com/superspeedyplugins/issue-tracker/issues/127 = 4.61 (23rd May 2024) = * #63 - Give more control over the taxonomies search - allow admins to choose not to search taxonomy description and only search taxonomy titles. * #63 - issue - Set option to "No", rebuild tables, still searching in category description. = 4.60 (23rd May 2024) = * #111 - SSS Ajax does not work if WP Installed in subfolder https://github.com/superspeedyplugins/issue-tracker/issues/111 = 4.59 (22nd May 2024) = * #115 - move the options that on change affact the readiness status to the top in main tab = 4.58 (22nd May 2024) = * Changed default for define( 'SSS_FAST_VISIBILITY_CHECK', true ); back to true - had changed it to false while developing and accidentally pushed it = 4.57 (22nd May 2024) = * Added a filter to let users use PHP filters to adjust the output (called 'sss_posts_search_where') - https://www.superspeedyplugins.com/kb/super-speedy-search/faq/how-to-hide-or-show-items-in-search-results/ * Added a new optional file called sss-filters.php that you place in your theme folder - This is because our Ultra Ajax avoids loading the theme for speed, so the normal functions.php file would not load = 4.56 (16th May 2024) = * #116 - Added a preview to the Gutenberg compatible widget = 4.55 (09th May 2024) = * #116 - Make SSS widget Gutenberg compatible = 4.54 (1st May 2024) = * Added new definition SSS_ENABLE_WOOSA - if you use the Wooosa VidaXL DS plugin, add the following to your wp-config.php to enable their external images in our Ultra ajax - define('SSS_ENABLE_WOOSA', true); = 4.53 (18th April 2024) = * Fixed bug in new "don't set" option for default post type to fix broken suggestion links which were including post_type=undefined = 4.52 (12th April 2024) = * Cleaned up auto-build a bit by removing wp_die() calls = 4.51 (11th April 2024) = * Added "Don't set" option for default post type - enabling this will prevent the addition of &post_type=product etc to the URL - be careful with this, only use it if you have your default search template set up correctly otherwise it will search all post types = 4.50 (4th April 2024) = * #68 - Fixed issue for Active/Inactive SSS status for all overrides option = 4.49 (27th March 2024) = * #108 Add slug search to the back-end admin search and front-end search for searching terms and products and everything into SSS https://github.com/superspeedyplugins/issue-tracker/issues/108 * #102 Add Use Global Settings option to Super Speedy Search widget https://github.com/superspeedyplugins/issue-tracker/issues/102 * #89 Add button to SSS Settings Advanced tab to let users delete plugin data on deactivation https://github.com/superspeedyplugins/issue-tracker/issues/89 * Partial WP CLI commands to make it easier for users to build or rebuild the tables - wp sss rebuild all - wp sss rebuild cancel - wp sss rebuild cancel force - wp sss rebuild search - wp sss rebuild suggestions * This dev version includes partial working admin bar to help users know when SSS is running or not = 4.48 (21st March 2024) = * Added more word boundaries for exact search matches so if users enter any special characters, they are fully searched for now = 4.47 (20th March 2024) = * Fixed bug with item searches where the search contains + symbol - e.g. ?s=RB5009UPR%2BS%2BIN&post_type=product (where %2B = +) * Added short token weights - customers were reporting things could not float to the top if the search involved 1 or 2 character tokens - added SSS_SHORT_TOKEN_WEIGHT_MULTIPLIER definition, default 50, for the short_token base multiplier - post_title gets bonus weight of SSS_SHORT_TOKEN_WEIGHT_MULTIPLIER * post_title weight multiplier - will consider adding short token weights to post_excerpt and post_content = 4.46 (28th February 2024) = * Added search form override for the Astra theme * Added workaround for client with Astra theme where for some reason,