Table of contents :

How Algolia Query Suggestions Work

100-days-of-algolia-037

Table of contents :

Algolia Query Suggestions turns previous searches into suggested queries that appear while a shopper types. For a WooCommerce store, this can help customers discover common product searches faster, reduce spelling friction, and guide users toward queries that are known to return useful results.

What Query Suggestions are

A query suggestion is a complete or partial search phrase, such as running shoes, waterproof hiking boots, or organic cotton t shirts. Algolia generates suggestions from search behavior and makes them available through a dedicated Query Suggestions index.

Query Suggestions are separate from the records in a product index. A product index contains products, prices, attributes, and inventory data. A Query Suggestions index contains phrases that can be presented before the user submits a search. Selecting a suggestion normally sends the shopper to a regular Algolia search using the selected phrase.

How the Query Suggestions pipeline works

  1. Search analytics collect queries. Customer searches are recorded through Algolia analytics when analytics is enabled and the application sends the appropriate search events.
  2. Algolia processes the search data. The Query Suggestions service evaluates search phrases and applies the configuration for the suggestion source, such as minimum popularity, phrase length, and filtering rules.
  3. Suggestions are generated. Accepted phrases are written to a Query Suggestions index. The index is typically managed separately from the WooCommerce product index.
  4. The frontend searches the suggestion index. As the shopper types, the search box or autocomplete interface sends the partial query to the Query Suggestions index.
  5. The shopper selects a phrase. The application uses the selected suggestion as the query for the product search index, rather than treating the suggestion itself as a product result.

Query Suggestions versus autocomplete results

These two features are often displayed together but answer different questions.

  • Query Suggestions: “What complete searches do customers commonly enter?”
  • Autocomplete product results: “Which products match the characters entered so far?”

For example, when a shopper types trail, Query Suggestions might return trail running shoes and trail running backpack. Product autocomplete might return individual products whose names or searchable attributes contain trail. A strong WooCommerce search experience can show both in separate sections of the autocomplete panel.

Where suggestions come from

The most common source is historical search analytics. This allows suggestions to reflect the vocabulary used by real customers instead of relying only on product names. Depending on the Algolia configuration and product requirements, agencies may also maintain or combine manually curated suggestions and other suggestion sources.

Analytics quality matters. If the store uses inconsistent application IDs, search-only API keys, replicas, or tracking settings, the collected search data may not represent the production search experience. Before enabling suggestions, verify that searches from the WooCommerce storefront are associated with the intended application and index.

Query Suggestions indexes

A Query Suggestions index is optimized for retrieving phrases, not for displaying product cards. It commonly includes a suggestion text field and metadata used by the autocomplete interface. The exact index name is configuration-dependent, so frontend code should use the name generated or configured for the Query Suggestions source rather than assuming a universal name.

The suggestion index should not replace the product index. A selected suggestion usually becomes a new query against the product index:

const selectedSuggestion = "waterproof hiking boots";
const results = await searchClient.search([
  {
    indexName: "products",
    params: { query: selectedSuggestion }
  }
]);

The example uses a normal product search after the user chooses a suggestion. The Query Suggestions lookup itself should target the configured suggestion index.

Using Query Suggestions in a WooCommerce autocomplete

For a custom storefront, agencies commonly use Algolia Autocomplete with the Query Suggestions plugin. The plugin handles the interaction pattern of reading the current input, searching the suggestion source, rendering suggestion items, and applying the selected query. The product source can be rendered alongside it.

import { autocomplete } from "@algolia/autocomplete-js";
import { createQuerySuggestionsPlugin } from "@algolia/autocomplete-plugin-query-suggestions";

const querySuggestionsPlugin = createQuerySuggestionsPlugin({
  searchClient,
  indexName: "YOUR_QUERY_SUGGESTIONS_INDEX",
  getSearchParams() {
    return { hitsPerPage: 6 };
  }
});

autocomplete({
  container: "#searchbox",
  plugins: [querySuggestionsPlugin]
});

In production, use the Query Suggestions index and parameters provided by the configured Algolia source. The exact plugin options can vary by version, so pin compatible package versions and verify the integration against the current Algolia Autocomplete documentation.

Ranking and filtering considerations

Popularity alone is not enough for a WooCommerce catalog. A phrase can be popular but commercially unhelpful, obsolete, or inappropriate for the current assortment. Review the Query Suggestions configuration and apply business rules where available.

  • Set a minimum number of searches so one-off phrases do not immediately become suggestions.
  • Set a minimum phrase length or word count to avoid low-value entries such as single letters.
  • Exclude profanity, internal terminology, personally identifying information, and phrases that should not appear publicly.
  • Remove discontinued product names or seasonal phrases when they are no longer useful.
  • Use manual suggestions for strategic categories, brands, or campaigns that have limited historical traffic.
  • Keep the number of visible suggestions small enough that product results remain usable on mobile devices.

Do not expose raw search logs directly in the user interface. Query Suggestions should be generated and filtered by Algolia’s configured process or by an approved curation workflow.

WooCommerce implementation details

When an agency builds a WooCommerce integration, the search experience usually has at least two independent data flows. Product synchronization sends WooCommerce products to a product index. Search analytics records queries and, where implemented, clicks or conversions. Query Suggestions uses the search behavior data to create suggestions, while the product index remains responsible for the final search results.

Make sure the search box uses the same language, market, and catalog context as the suggestion source. A global suggestion such as men's shoes may be misleading on a storefront that applies country, currency, or catalog-visibility rules. If the storefront has multiple locales or catalogs, consider separate sources or appropriate filtering and indexing strategies.

Selection behavior should also be explicit. Pressing Enter may submit the raw text, while clicking a suggestion should submit the suggestion text. Track these interactions consistently so the analytics data reflects both search intent and suggestion performance.

Measuring whether suggestions help

Useful measures include suggestion impressions, suggestion selection rate, submitted searches after interaction, zero-result rate, product click-through rate, add-to-cart rate, and conversion rate. Compare searches that began with a selected suggestion with searches entered manually, while accounting for device type, catalog, and query length.

A high selection rate is not automatically a success signal. If suggestions attract clicks but lead to zero-result searches or low product engagement, the source may contain stale phrases or the product index may not support the suggested vocabulary. Review the full path from suggestion to product result.

Common integration mistakes

  • Searching the product index for suggestions: This produces product hits rather than curated search phrases and can make the autocomplete panel noisy.
  • Using the wrong index name: Query Suggestions indexes are configured resources and should be identified from the Algolia setup.
  • Ignoring analytics configuration: Without reliable search analytics, generated suggestions may be sparse or unrelated to actual customer behavior.
  • Submitting the display label instead of the intended query: If a suggestion includes markup or metadata, keep the underlying query separate from its rendered label.
  • Failing to escape rendered text: Treat suggestion text as untrusted data when creating custom HTML and escape it before insertion.
  • Keeping stale suggestions indefinitely: Seasonal products, discontinued brands, and temporary campaigns require review and refresh policies.

Practical agency checklist

  1. Confirm that production searches are tracked in the intended Algolia application.
  2. Configure a Query Suggestions source and identify its generated index.
  3. Set minimum popularity, length, and exclusion rules appropriate for the catalog.
  4. Connect the source to the autocomplete interface separately from product results.
  5. Test keyboard navigation, mobile rendering, Enter-key behavior, and selected-suggestion behavior.
  6. Verify that selecting a suggestion searches the correct WooCommerce product index and respects catalog rules.
  7. Review analytics for zero-result searches, stale phrases, and suggestion-driven conversions.
Trending posts
You might also like