Learn how Product Search helps customers find, filter, and sort Products on your storefront.
Storefront search helps customers find Products in an online shop. Customers enter search terms, narrow the results with filters, and sort the results, typically on a product listing page, which is a storefront page that lists Products. Product Search provides this functionality. It searches a dedicated search index of published Products, which provides fast and relevant results. This area covers what Product Search finds, how a business switches it on, and how fast changes to the catalog appear in search results.
Administrators and storefront developers typically set up storefront search, either in the Merchant Center or with the APIs:
Key concepts
Product Search
Product Search lets a storefront offer customers a way to browse and search for Products. A business uses it on product listing pages, where customers enter search terms, refine the results, and sort them. By default, Product Search finds the matching Products and returns only their IDs, which gives short response times. The storefront then loads the details that it displays, such as names and Prices, from the Product data. Search can filter, facet, and sort by Prices, but the raw search results don't contain Price data. A storefront can also retrieve Prices with the product details in enriched results.
- For developers: Product Search in the Storefront search APIs overview
Full-text search
Full-text search lets customers find Products by entering search terms. Customers can search by a Product's name, description, search keywords, and searchable text Attributes. A SKU can also be searched as a keyword, but it isn't a full-text field. A search doesn't have to be an exact match. It can match the beginning of a word (prefix) or part of a word (wildcard), and fuzzy search accounts for typos and misspellings in the search terms.
Product Search analyzes the localized Product data in each language of the Project with the best-fitting analysis for that language, and it supports 30 languages. Only the languages that are set in the Project are searchable. If a Product has text in a language that the Project doesn't list, that text isn't searchable. For example, a Project has English and German as languages, and a Product has a name in German and a name in Romanian. Customers can find the Product by its German name, but not by its Romanian name. A search in a language that the Project doesn't list returns no results.
- For developers: Full-text search in the Storefront search APIs overview
Filters and facets
Facets give you statistical information about your data. A facet answers questions like "how many t-shirts of size XL are there?" or "how many TVs are there that cost between US$500 and US$600?" The first question is answered by a facet that counts each distinct value of an Attribute. The second question is answered by a facet that counts the Products with a value in a specified range.
- For developers: Filters and facets in the Storefront search APIs overview
Sorting
- For developers: Sorting in the Storefront search APIs overview
Searchable Attributes
A business decides which Attributes customers can search, filter, and facet by when it defines the Attribute on a Product Type. An Attribute is searchable only if it is marked as searchable in every Product Type that uses an Attribute with the same name. If the setting differs between Product Types, the Attribute isn't available for search, filters, or facets.
Product Search indexes both Product Attributes, which apply to the whole Product, and Variant Attributes, which apply to a single Product Variant. It indexes only the Attributes that have a value on the Product or Product Variant. If a Product Type defines an Attribute but a Product Variant has no value for it, search doesn't index that Attribute. Product Search indexes a limited number of Attributes for each Product and Product Variant. If a Product Variant has more searchable Attributes than the limit, the indexer takes them in the order in which the Product Type defines them.
- In the Merchant Center: Add an Attribute
- For developers: Searchable Attributes in the Storefront search APIs overview
Activate the Product Search API
Product Search isn't active in a Project by default. A business switches it on before first use, either in the Merchant Center or with the APIs. Once Product Search is switched on, commercetools indexes the Products. Searches work soon after, and they fail while the indexing is in progress.
Product Search switches off by itself if nobody searches for 30 consecutive days. Once it is off, the Project rejects all search requests until a business switches Product Search on again.
How the concepts relate
productsSearch request.Lifecycle and states
Product Search availability
The following diagram shows when Product Search is available in a Project.
Product Search is deactivated by default. When a business switches it on, commercetools indexes the Products, and searches fail until the indexing is complete. Then Product Search is activated. A business can switch it off, and commercetools switches it off after 30 days without a search. A business can switch it on again.
Index updates
Product Search reads from the search index, not directly from the Products. An event-driven indexing process keeps the index current, so a change to a Product doesn't appear in search results immediately. The product information in the search index can differ from the latest data until the indexing is complete.
The following diagram shows how a change to the catalog reaches the search index.
An incremental update takes a few minutes on average. If many Products change at once, for example in a batch, it can take longer. A full reindex takes about 15 minutes on average. It can take longer, depending on the number of Products in the catalog, the number and size of the Product Variants, the number of Standalone Prices, and the number of Product Selections and Stores in the Project.
- For developers: Index updates in the Storefront search APIs overview
Common scenarios
Build a product listing page
A business with a large catalog builds a product listing page, so that customers can browse and search its Products. The page typically has the following features:
- A search bar for full-text search.
- A search results page that customers refine with filters, such as Category, price range, and Attributes like color, brand, style, or material.
- Sorting, for example by price or by newest, and pagination, to split a large set of Products into manageable pages.