Gatemi Product Search Developer Reference

Free edition

The free edition applies no filters or actions of its own.

Item Value
Shortcode [gatemi_product_search] (no attributes)
REST route GET /wp-json/gatemi-ps-free/v1/suggest?q=… — public, returns up to 8 products, empty array below 2 characters
Suggestion fields title, url, price (plain text), thumb (thumbnail URL)
Form submits /?s=…&post_type=product
Option gmpsrf_settings — array( 'auto' => 'yes' | 'no' )
Script config window.gmpsfSearch = { endpoint, min }, added inline before the gmpsrf-search script
Automatic placement woocommerce_before_shop_loop, priority 5

CSS classes: .gmpsrf-form, .gmpsrf-input, .gmpsrf-submit, .gmpsrf-results (the suggestion box, a <ul> of links), .gmpsrf-title, .gmpsrf-price.

/* Wider suggestion box with a border. */
.gmpsrf-results { min-width: 320px; border: 1px solid #ddd; }
.gmpsrf-price  { font-weight: 600; }

Full edition

Shortcodes

[gatemi_product_search] — attributes placeholder, button_text, show_button (default true), instant (default: the Suggest products while typing setting), limit (suggestions, default 6, 1–20), class.

One shortcode per filter, [gatemi_product_filter_<id>]:

Id Filter
category, tag, brand Term lists (hide_empty, limit 100, orderby name or count, hierarchical, multiple)
attribute One attribute — attribute="pa_colour"
price Price range with inputs
rating Minimum star rating
sale On sale only
stock In stock only
reset Active-filter chips and a clear link (show_chips)
grid The product grid (columns 4, limit 12, paginate, show_result)

Every filter also accepts title, show_title, show_count and class.

[gatemi_product_filter_attribute attribute="pa_size" title="Size" show_count="no"]

Blocks

gatemi-product-search/search and gatemi-product-search/filter-<id> for each id above, in the WooCommerce block category. Their attributes are the shortcode attributes. They are dynamic blocks, rendered by the same PHP as the shortcodes.

REST route

GET /wp-json/gatemi-ps/v1/suggest?q=…&limit=… — public and cacheable. Returns { term, results }; each result has id, title, url, price, sku and more. limit defaults to 6 and is capped by gatemi_product_search_instant_limit.

URL arguments

Argument Meaning
gmps Search term
gmpsf Categories
gmpst Tags
gmpsb Brands
gmpsa Attributes
gmpsp, gmpsp_min, gmpsp_max Price range
gmpsr Minimum rating
gmpss On sale
gmpse In stock
gmpso Order by

Filters

Filter Default Purpose
gatemi_product_search_settings — The resolved settings array
gatemi_product_search_field_weights see below Weight per indexed field
gatemi_product_search_min_token 2 Shortest word indexed and searched
gatemi_product_search_stopwords built-in list Words skipped
gatemi_product_search_indexed_fields — ( $fields, $post ) text by field before tokenizing
gatemi_product_search_token_weights — ( $totals, $post ) final word → weight map
gatemi_product_search_indexed_taxonomies — Taxonomies indexed and filterable
gatemi_product_search_attribute_taxonomies — Attribute taxonomies
gatemi_product_search_brand_taxonomy product_brand Brand taxonomy
gatemi_product_search_indexable_statuses array( 'publish' ) Post statuses indexed
gatemi_product_search_index_batch 50 Products per background batch
gatemi_product_search_max_result_rows 1000 Rows a search scores
gatemi_product_search_typo_tolerance true Correct misspelled words
gatemi_product_search_instant_limit 10 Suggestion ceiling (1–20)
gatemi_product_search_suggest_max_age 60 Cache-Control max-age of suggestions, seconds
gatemi_product_search_cache_lifetime 600 Seconds filter counts stay fresh
gatemi_product_search_cache_context locale Extra key that splits caches (e.g. per language)
gatemi_product_search_handles_query — ( $handled, $query ) whether a query is answered from the index
gatemi_product_search_takeover_core_search true Answer ?s= product searches from the index
gatemi_product_search_results_url shop page Where the form submits
gatemi_product_search_price_clause — ( $sql, $price, $alias ) price comparison
gatemi_product_search_filters — Filter id → class map
gatemi_product_search_filter_terms_args — ( $args, $taxonomy, $atts ) term query
gatemi_product_search_filter_html — ( $html, $atts, $filter )
gatemi_product_search_form_html — ( $html, $atts )
gatemi_product_search_block_definitions — Registered blocks
gatemi_product_search_auto_hook woocommerce_before_shop_loop Where the automatic panel prints
gatemi_product_search_auto_priority 5 Its priority
gatemi_product_search_auto_filters — Which filters it shows
gatemi_product_search_auto_full_width true Let the theme sidebar make way
gatemi_product_search_auto_render — Whether it renders on this request
gatemi_product_search_auto_html — Its HTML
gatemi_product_search_enqueue_assets — Whether the storefront files load
gatemi_product_search_script_settings — Data passed to the script
gatemi_product_search_grid_selectors — CSS selectors for the product loop
gatemi_product_search_should_log not a crawler ( $should, $state ) record this search
gatemi_product_search_log_retention 180 Days log rows are kept

Default field weights: title 20, sku 20, excerpt 8, taxonomy 6, attribute 4, variation 4, content 2.

// Make the short description count as much as the title.
add_filter( 'gatemi_product_search_field_weights', function ( $w ) {
	$w['excerpt'] = 20;
	return $w;
} );

// Render the automatic panel on a block theme's hook instead.
add_filter( 'gatemi_product_search_auto_hook', fn() => 'my_theme_before_products' );

Changing what is indexed takes effect for a product the next time it is indexed; press Rebuild the index to apply it to all of them.

Actions

Action Arguments When
gatemi_product_search_loaded — After the plugin has booted
gatemi_product_search_query_prepared $query, $state After a product query is taken over
gatemi_product_search_index_updated $result After a background batch

Storage

Item Name
Tables {prefix}gatemi_ps_index, _object, _queue, _log
Settings gatemi_product_search_settings
Schema version gatemi_product_search_db_version
Rebuild cursor / lock gatemi_product_search_rebuild_cursor, gatemi_product_search_index_lock
Licence gatemi_ps_license
Cron gatemi_product_search_process_index (every minute, schedule gatemi_product_search_minutely), gatemi_product_search_prune_log (daily), gatemi_ps_license_check (twice daily)

CSS classes

Search: .gmps-search, .gmps-search--instant, .gmps-search__field, .gmps-search__input, .gmps-search__submit, .gmps-search__results, .gmps-search__corrected. Filters: .gmps-filter, .gmps-filter__title, .gmps-filter__body, .gmps-choices, .gmps-choice, .gmps-choice--selected, .gmps-choice__count, .gmps-price__*, .gmps-rating__star--on, .gmps-chips. Automatic panel: .gmps-auto, .gmps-auto__search, .gmps-auto__filters, .gmps-auto__toggle; the body gets .gmps-full-width when the sidebar makes way. .gmps-busy is set while a filtered view loads.

Shopping Cart
Scroll to Top