A lightweight WooCommerce companion plugin that builds a static JSON index of products and powers a client-side autocomplete dropdown for instant search. This document walks through the design decisions, folder structure, and known limitations so future iterations can follow the same reasoning.
- Purpose – Provide a zero-dependency product search that feels instant and gracefully falls back to the default WooCommerce search results.
- Approach – Generate a trimmed product index during cron/CRUD events, ship it to the browser, then filter/sort matches on the client.
- Scope – Only parent products with public catalog visibility are indexed; variations remain discoverable via their parent listings.
blink-search-indexer/
├── blink-search-indexer.php # Main plugin bootstrap and documentation-heavy logic
├── public/
│ ├── search.js # Front-end behaviour and scoring helpers
│ └── search.css # Default styling for the dropdown UI
├── LICENSE # GPLv3 license text
└── README.md # This file
The source code includes explanatory blocks that narrate the original intent:
blink-search-indexer.phpdocuments when/why the index rebuilds, why a transient lock exists, and how the shortcode keeps forms accessible.public/search.jsreads like a mini design doc describing the scoring model, lazy loading strategy, and trade-offs around event listeners.public/search.csscarries inline notes clarifying the visual hierarchy and WooCommerce overrides bundled with the plugin.
- Copy the
blink-search-indexerdirectory intowp-content/plugins/. - Activate "Blink Search Indexer" inside the WordPress admin.
- Add the
[blink_search]shortcode anywhere you want the autocomplete box. - (Optional) Override the default styles by dequeuing
blink-search-cssand adding your own CSS rules.
The public/search.css file controls the styles for the dropdown, empty state, and WooCommerce overrides.
Because the CSS ships separately from the JavaScript you can override or replace it without forking the plugin.
- Trigger index rebuilds by saving a product or taxonomy term.
- Confirm the dropdown suggestions appear after typing three or more characters.
- Validate that the "See all results" link always points to the canonical search results page using the current query.
This project is distributed under the GNU General Public License v3.0 (see the
included LICENSE file). Authored by Philip V. Jancsy; contributions are
welcome so long as they remain compatible with GPLv3.