SwiftSearch replaces your default WordPress search with an instant, typo-tolerant search engine powered by Algolia. It's designed for speed, converting your visitors into customers with lightning-fast results.
Zero Latency
Runs entirely in the browser. No waiting for your WordPress database (MySQL) to query results.
Most Secure
We use digital signatures to protect your API keys. Your connection settings are tamper-proof.
Server Offload
Offload search queries to Algolia. Your WordPress server breathes easier, even during traffic spikes.
Mobile First
Includes a sticky mobile search button and a responsive overlay UI designed for touch devices.
1. Installation
Create an Algolia Account
Sign up at Algolia.com. Algolia offers a generous free tier (Build plan) including 10,000 search requests and 10,000 records per month.
Install the Plugin
Upload the swiftsearch-for-algolia.zip file to your WordPress Plugins dashboard
and activate it.
Setup Wizard
Go to the SwiftSearch menu in your admin dashboard. Enter your Algolia Application ID, Search-Only API Key, and Admin API Key to connect.
2. Configuration & Indexing
SwiftSearch simplifies index management with a robust dashboard.
API Keys Best Practice
For optimal security, we recommend using two separate API keys:
- Admin Key: Used by the plugin to create index settings, configure sorting replicas, and index content securely from the backend.
- Search-Only Key: Used by the frontend/browser to fetch results. This key is read-only and safe to expose.
Reliable Background Indexing
Click "Index All" to start building your search index. The plugin uses the industry-standard secure background batch loopbacks and WP-CLI commands to process thousands of items in the background without slowing down your site.
3. Features & Capabilities
Instant Search
Results appear instantly as you type. Provides a "Google-like" autocomplete experience.
Typo Tolerance
State-of-the-art spell correction. Finds "iPhone" even if a user types "iphoen".
WooCommerce
Fully compatible. Indexes Products, SKUs, Prices, Categories, and Stock Status.
Unified Search
Search everything: Posts, Pages, Products, Custom Post Types, and Authors.
Faceted Filters
Let users refine results by Category, Price, or Brand. Instant updates without reload.
Precision Ranking
Control exactly how results are ranked. Prioritize matches in Titles or boost Stock.
Synonym Sets
Define synonyms (e.g., "Parka" = "Jacket") so users always find what they need.
Pinning
Manually pin specific products to the #1 spot for high-value search terms.
Custom Fields
Index and search within custom meta or map any custom database field (e.g. SEO Meta).
Search Analytics
Track "Top Queries" and specifically "No Result Queries" to discover gaps.
Catalog Mode
Replace the default WooCommerce Shop page with a high-performance search and filter catalog page layout.
Page Builder Friendly
Works with Elementor, Divi, and Gutenberg blocks via automatic form replacement or simple shortcodes.
Automated Sync
Real-time indexing when you Save, Update, or Delete content. No manual sync required.
Full Technical Feature List
4. Displaying the Search
To display the clean search bar anywhere on your site (header, sidebar, or inside a page), use the shortcode:
[swift_search_algolia]
(The shortcode [swift_search] is also fully supported as a drop-in alias).
Advanced Options
You can customize the search behavior using specific attributes:
placeholder: Custom placeholder text (Default: "Search...").limit: Maximum number of results to display (Default: 10).show_thumbnail: "true" to show images, "false" for text-only.post_types: Comma-separated list (e.g. "product,post").
Example Usage
[swift_search_algolia placeholder="Find products..." limit="8" post_types="product" show_price="true"]
5. Theming & Customization
The search interface is designed to inherit your theme's fonts, but you can override styles using standard CSS.
/* The Outer Wrapper */
.ss-wrapper {
max-width: 600px;
}
/* The Search Input Box */
.ss-search-box input {
border-radius: 8px;
border: 2px solid #e5e7eb;
}
/* Highlighted Matches */
.ss-hit-title mark {
background-color: rgba(255, 0, 85, 0.1);
color: #ff0055;
}
6. Developer Hooks
SwiftSearch provides several filter hooks and DOM events allowing developers to programmatically customize indexing, styling, search behaviors, and track events.
PHP Actions & Filters
swift_search_algolia_post_document (Filter)
Modify or append custom fields to the document data array before it gets synced to Algolia.
add_filter('swift_search_algolia_post_document', function($document, $post_id, $post) {
// Example: Add a custom field to the indexed document
$custom_meta = get_post_meta($post_id, 'my_custom_field', true);
if (!empty($custom_meta)) {
$document['my_custom_field'] = sanitize_text_field($custom_meta);
}
return $document;
}, 10, 3);
swift_search_algolia_should_index_post (Filter)
Conditionally control whether a post should be indexed into Algolia.
add_filter('swift_search_algolia_should_index_post', function($should_index, $post_id, $post) {
// Example: Exclude products that are out of stock
if ($post->post_type === 'product' && function_exists('wc_get_product')) {
$product = wc_get_product($post_id);
if ($product && !$product->is_in_stock()) {
return false;
}
}
return $should_index;
}, 10, 3);
swift_search_algolia_settings (Filter)
Customize index settings before deployment to Algolia, including searchable attributes, custom ranking rules, and facets:
add_filter('swift_search_algolia_settings', function($settings, $config, $base_index_name) {
// Make custom field searchable and filterable
$settings['searchableAttributes'][] = 'my_custom_field';
$settings['attributesForFaceting'][] = 'searchable(my_custom_field)';
// Add custom ranking rules
$settings['customRanking'] = array('desc(total_sales)', 'desc(date)');
return $settings;
}, 10, 3);
swift_search_algolia_vars (Filter)
Modify frontend JS configuration parameters (e.g. adjust multi-currency format, dynamic limits) before they are passed to the frontend browser runtime.
add_filter('swift_search_algolia_vars', function($vars, $settings) {
// Example: Force search to prioritize a custom currency symbol
$vars['currencySymbol'] = '€';
return $vars;
}, 10, 2);
Frontend JavaScript Custom Events
SwiftSearch dispatches native JavaScript events on the document node during various lifecycle states:
swiftsearch:init: Fired when the search input is mounted and ready.swiftsearch:results: Fired after hits are rendered. Passes detail payload containing results and query meta.swiftsearch:select: Fired when a user clicks or selects a search hit item.
document.addEventListener('swiftsearch:results', function(event) {
console.log('Search Query:', event.detail.query);
console.log('Hits Found:', event.detail.count);
});
7. WP-CLI Commands
SwiftSearch includes native command-line support via WP-CLI. This is highly recommended for developers and system administrators managing large catalogs (10,000+ items) to bypass PHP execution time limits and local server loopback restrictions.
Bulk Indexing
Perform a complete, fast bulk index of all active post types directly via SSH terminal. Bypasses the browser AJAX and local HTTP request stack completely:
wp swift-search-algolia index
Available Options:
--batch-size=<number>: Number of posts/products to process and import in each Algolia request. (Default:250).--offset=<number>: Skip the first N items before starting. Useful for resuming an interrupted sync or splitting up massive catalogs. (Default:0).--limit=<number>: Only index a maximum of N items in this run. (Default: no limit).
Examples:
# Index posts 0 to 5000 in batches of 500
wp swift-search-algolia index --offset=0 --limit=5000 --batch-size=500
# Resume and index posts 5000 to 10000
wp swift-search-algolia index --offset=5000 --limit=5000 --batch-size=500
Check Index & Connection Status
Inspect server connectivity, verify document counts, and inspect active Algolia indices:
wp swift-search-algolia status
Reset & Recreate Indices
Drop existing Algolia indices and rebuild the settings and sorting replicas from scratch:
wp swift-search-algolia reset
8. Troubleshooting & FAQ
Result "Connection Failed"?
Double check that your Algolia Application ID, Search-Only API Key, and Admin API Key are copied accurately from the API Keys tab in your Algolia Dashboard. Ensure there are no accidental leading or trailing whitespaces.
Why do Algolia Replica Indices show fewer records than the Primary Index?
In Algolia, replica indices configured with a specific sorting attribute (such as price_asc or price_desc) omit documents that do not contain that numerical field (such as regular blog posts or uncategorized items without a price). This is native Algolia indexing behavior and does not indicate data loss.
Does SwiftSearch comply with Algolia Record Size Limits?
Yes. Algolia enforces a maximum record size (10KB on the Free/Build tier, 100KB on Grow and Premium plans). SwiftSearch automatically strips all HTML markup using WordPress native wp_strip_all_tags() and trims extensive content blocks to ensure your records comfortably stay within Algolia's limits.
Does the plugin support WooCommerce variable products?
Yes. SwiftSearch indexes WooCommerce products and fully supports SKU, tags, category terms, and stock status. For pricing, it indexes the active price of the product to ensure accurate sorting and range filters.