WP Search with Algolia
The WP Search with Algolia plugin powers the Dealers Site's product search and browse experience, integrating the WordPress frontend with the Algolia search service.
Plugin Details
| Property | Value |
|---|---|
| Plugin | WP Search with Algolia |
| Location | plugins/wp-search-with-algolia/ |
| Algolia Library | Algolia PHP API Client |
What Gets Indexed
The plugin indexes the following content types:
| Index Type | Content |
|---|---|
| Products | All published WooCommerce products including meta, categories, tags, and pricing |
| Posts (non-products) | Pages and posts (via the custom Algolia_Searchable_Posts_Index_Not_Products class) |
Product Index Attributes
Each Algolia product record contains attributes from the Plugins' default schema plus custom attributes added by the WooCommerce store and the Middleware pricing sync:
objectID— WooCommerce product IDsku— Product SKUpost_title— Product namecategories— Array of WooCommerce category namestags— Array of WooCommerce tagsregular_price— Current ask price (updated by Middleware pricing sync)retail_tiers— Volume pricing tiers (updated by Middleware pricing sync)_thumbnail_id/images— Product images
Theme Integration
The Suma Elementor theme's Algolia class (inc/class-algolia.php) extends the plugin's functionality:
- Customises which product attributes are included in the index record
- Adds custom data transformation before indexing
The AlgoliaCustomSearch class (inc/class-algolia-custom-search.php) registers a separate Algolia index for non-product posts, ensuring the product pricing index is kept clean.
Frontend Search
On search pages (is_search() returns true), the theme loads the Algolia InstantSearch.js library:
if ( is_search() && defined( 'ALGOLIA_VERSION' ) ) {
wp_enqueue_script( 'algolia-instantsearch' );
wp_enqueue_style( 'algolia-instantsearch' );
}
InstantSearch.js renders results client-side with live filtering and pricing display.
Re-indexing
To re-index all products (e.g., after a bulk product import):
# Via WP-CLI
wp algolia re-index --index_name=products
# Via WP Admin
# Navigate to Algolia → Indexing → Re-Index
Configuration
Algolia credentials are in wp-config.php:
define( 'ALGOLIA_APP_ID', 'XXXXXXXXXX' );
define( 'ALGOLIA_API_KEY', 'xxxxxxxx' ); // Search-only key (public)
Admin API key for indexing/management is configured in WP Admin → Algolia → Settings → API.