=== Aknex Fast Product Search for WooCommerce ===
Contributors: akifquddus
Tags: woocommerce, search, product search, live search, ajax search
Requires at least: 6.2
Tested up to: 7.0
Stable tag: 1.0.0
Requires PHP: 7.4
Requires Plugins: woocommerce
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Instant, variation-aware WooCommerce product search powered by a dedicated index table — no wp_posts queries on the search path.

== Description ==

Aknex Fast Product Search replaces the default WooCommerce product search with a lightning-fast, search-as-you-type widget backed by its own denormalized MySQL index. Because search queries run against a single flat index table instead of `wp_posts` and `wp_postmeta`, results are returned in milliseconds even on shared hosting with 100,000+ products.

== Premium Turbo edition ==

A separately licensed Turbo edition includes:

* **SHORTINIT direct search** — uses a lightweight endpoint when supported by the host, with the WordPress REST API as a fallback.
* **License management** — activate and validate an Aknex license for the Turbo site.
* **Automatic updates** — receive Turbo releases through the WordPress plugin updater while the license is valid.

An active Aknex license is required. [Learn about Turbo](https://aknexdigital.com/aknex-fast-product-search).

**Key features:**

* **Variation-aware** — variations are indexed as individual rows. Choose between three result modes per widget instance: parents only, all variations as standalone results, or variations collapsed under their parent.
* **Field-scoped search** — restrict search to any combination of title, SKU, categories, tags, and attributes using a simple shortcode parameter.
* **Configurable index fields** — choose which product data (SKU, categories, tags, attributes, short description) is included in the full-text index via the admin settings page.
* **REST transport** — search requests run through a dedicated WordPress REST API route for compatibility with WordPress.org requirements.
* **Gutenberg block + shortcode** — embed the search widget anywhere. An optional filter automatically replaces the default WooCommerce search form site-wide.
* **Smart indexing** — full rebuild runs as a chunked, resumable background job using Action Scheduler (bundled with WooCommerce). Incremental updates are queued automatically on product save, stock change, and deletion. A nightly reconciliation job keeps the index consistent.
* **Micro-cache** — a short-lived database cache layer prevents redundant queries for popular search terms under high traffic.
* **Rate limiting** — configurable per-IP request throttling protects the search endpoint.
* **WP-CLI support** — `wp fastsearch rebuild`, `wp fastsearch status`, and `wp fastsearch flush` commands for DevOps workflows.
* **HPOS compatible** — fully compatible with WooCommerce High-Performance Order Storage.
* **Multisite ready** — one index table per site via `$wpdb->prefix`.

**Shortcode usage:**

`[fastsearch]`

Optional attributes:

* `placeholder` — input placeholder text
* `mode` — `parents` (default), `all`, or `collapse`
* `fields` — comma-separated: `title`, `sku`, `categories`, `tags`, `attributes`, or `all` (default)
* `cat` — restrict results to a category ID
* `limit` — number of results (1–50, default 10)

Example: `[fastsearch mode="collapse" fields="title,sku" limit="8"]`

**Requirements:**

* WordPress 6.2 or later
* WooCommerce 8.0 or later
* PHP 7.4 or later
* MySQL 5.7+ or MariaDB 10.3+ with InnoDB and FULLTEXT support

If FULLTEXT indexing is unavailable on your host, the plugin automatically falls back to prefix-LIKE mode with a notice in the admin dashboard.

== Installation ==

1. Upload the `aknex-fast-product-search` folder to the `/wp-content/plugins/` directory, or install through the WordPress plugin screen directly.
2. Activate the plugin through the **Plugins** screen in WordPress.
3. Navigate to **WooCommerce > FastSearch** to configure settings.
4. Click **Rebuild index** to build the initial product index.
5. Add `[fastsearch]` to any page or widget area, or enable **Replace WooCommerce search form** in settings to replace the theme's search form automatically.

**Recommended after installation:**

* After changing any **Index fields** settings, click **Rebuild index** to apply the changes.

== Frequently Asked Questions ==

= Does this plugin require WooCommerce? =

Yes. Aknex Fast Product Search is a WooCommerce extension and will not activate without WooCommerce installed and active.

= Will it work with variable products and variations? =

Yes. Variable products and their variations are indexed individually, giving you precise control over how variations appear in results via the `mode` shortcode attribute.

= What happens if my server does not support FULLTEXT indexing? =

The plugin detects this at activation and falls back to prefix-LIKE search mode automatically. You will see a notice in the admin dashboard. Search still works correctly in LIKE mode; you lose mid-word matching for longer tokens.

= Does the plugin add load to my database on every search? =

Queries run against the plugin's own index table — a single flat, indexed table. The search path never touches `wp_posts` or `wp_postmeta`. Combined with the built-in micro-cache, repeated popular queries are served from a cache table with zero query overhead.

= How do I keep the index up to date? =

The index is updated automatically when products are saved, their stock status changes, or they are deleted. A nightly reconciliation job also runs to catch any missed changes. You can trigger a full rebuild at any time from the settings page or via WP-CLI (`wp fastsearch rebuild`).

= Is the plugin multisite compatible? =

Yes. Each site in a multisite network gets its own index table via WordPress's `$wpdb->prefix`.

= What data is stored, and is any data sent externally? =

The plugin stores a denormalized copy of your product data (title, SKU, categories, tags, attributes, price, stock status, image URL, product URL) in a local database table. No data is sent to any external service. All processing happens on your own server.

= How do I remove all plugin data on uninstall? =

Enable **Delete all data on uninstall** in the plugin settings before deactivating and deleting the plugin. When enabled, all index tables and plugin options are removed on uninstall.

= Can I use multiple search widgets on one page? =

Yes. Each `[fastsearch]` shortcode instance is independent and can be configured with different parameters.

== Screenshots ==

1. The search widget in action — instant results as you type.
2. Admin settings page showing index status and configuration options.
3. Index fields settings — choose exactly which product data is searchable.

== Changelog ==

= 1.0.0 =
* Initial release.

== Upgrade Notice ==

= 1.0.0 =
Initial release. After upgrading, visit WooCommerce > FastSearch and click Rebuild index.
