How to fix autocomplete and SKU search issues
This guide covers two common problems: the autocomplete dropdown shows different products than the search results page, and a search by SKU or part of a SKU finds nothing. Each section starts with the answer, then lists the causes, how to check which one applies, and how to fix it.
Autocomplete shows different products than the search results page
Autocomplete and the search results page are two separate requests, so they can return different products. In Search Ultimate, autocomplete in its default mode gets products through the same search collection as the results page, with the same search index, searchable attributes and weights. When the two lists still differ, the cause is almost always one of these: Enable fast mode is on and autocomplete reads data saved at the last reindex, autocomplete shows only the first few results, or the results page shows results the autocomplete never shows by design (filters, sorting, other store views).
Default Magento autocomplete does not show products at all. It suggests earlier search queries from Marketing -> SEO & Search -> Search Terms. If your dropdown shows products, they come from Search Ultimate (or another extension).
Causes
-
Fast mode is enabled
With Enable fast mode, autocomplete sends the query straight to Elasticsearch or OpenSearch without loading Magento. It uses its own copy of the index settings and product data (name, price, image, stock) that was written to the index during reindex. The copy of the settings is rebuilt when you save the Search autocomplete or Search ultimate configuration, and on a full reindex of the catalog search index. Until then:
- changes to searchable attributes or weights in System -> Search Management -> Search indexes are not used by autocomplete;
- product changes made after the last reindex are not shown in autocomplete. With fast mode, only the final price is shown.
-
Autocomplete shows only the top results
Each index in autocomplete shows at most Max number of results items, sorted by relevance. The results page shows the full list. A product ranked below the limit appears only on the results page.
-
The results page applies things autocomplete does not
On the results page the customer can change the sort order and apply layered navigation filters. If Enable cross-store search is on, the results page also shows tabs for other store views, while autocomplete always stays in the current store view.
How to check which cause applies
-
Navigate to Stores -> Configuration -> Mirasvit extensions -> Search autocomplete -> Autocomplete base configuration and check Enable fast mode. If it is Yes, cause 1 is likely, especially if you changed index attributes or products recently.
-
In the same section, check Max number of results for the Product index in Searchable content. Then open the results page for the same query with no filters and the default Relevance sort. If the missing product is below that position, it is cause 2.
-
Use the Search results validator (Elasticsearch and OpenSearch only) to see how the query scores each product and whether a product is indexed at all.
-
For a closer look, turn on Stores -> Configuration -> Mirasvit extensions -> Search ultimate -> General -> Developer Mode and add
?debug=searchto the results page URL. The page shows search debug information. Turn Developer Mode off when you are done, it is not meant for production.
How to fix it
-
Fast mode data is outdated. Run a full reindex of the catalog search index. It rebuilds both the product data and the autocomplete copy of the index settings:
bin/magento indexer:reindex catalogsearch_fulltextIf autocomplete must always match the results page without waiting for a reindex, set Enable fast mode to No. Autocomplete becomes slower, but it reads results the same way as the results page.
-
The product is below the autocomplete limit. Increase Max number of results for the Product index, or improve its ranking with search weights or Product boost rules. For the Full size dropdown layout you can also enable the Pagination toolbar (see Search autocomplete settings).
-
Filters, sorting or cross-store tabs. This is expected behavior. Compare the lists with no filters, the Relevance sort and the current store view only.
Search by SKU or part of a SKU does not find products
A product is found by SKU only when the SKU attribute is searchable and added to the Product search index. A partial SKU additionally needs wildcard search, a SKU with dashes or slashes needs a long-tail rule, and a SKU of a configurable product's child needs the Search by child products option. After each change, reindex.
For the basic setup, see How to configure search by SKU. The causes below explain what to check when search by SKU still fails.
Causes
-
SKU is not searchable
Use in Search is off for the SKU attribute, or SKU is missing from Searchable attributes of the Product index. In versions before 2.8.0, turning Use in Search off for SKU broke the whole storefront and GraphQL search with the error
Cannot search on field [sku] since it is not indexed. Since 2.8.0, the search skips fields that are not indexed. -
Wildcard search does not cover the part of the SKU
Search by part of a word depends on Wildcard search. The default is Enabled (*word*), which matches any part. Enabled at the end (word*) matches only the beginning of a SKU, Enabled at the start (*word) only the end, and Disabled requires the full value. The SKU attribute can also have its own Wildcard value in the Product index that overrides the global setting, and words in Wildcard exceptions are never matched partially.
-
The SKU contains dashes, slashes or spaces
Customers type
SX500123,SX-500-123orSX500 123for the same product. Long-tail rules exist to make such variants match: without a Long-tail search expressions rule, a query with a different separator may not find the product. -
The SKU belongs to a child product
Simple products of a configurable, grouped or bundle product are usually set to Not Visible Individually, so search does not return them. Their SKUs are not part of the parent's record unless Search by child products is enabled.
-
Spell correction changed the query
Older versions could treat a SKU or model number as a typo and replace it. Spell correction skips queries with numbers since version 2.3.14, and in fast mode autocomplete since version 2.8.4.
How to check which cause applies
-
Navigate to Stores -> Attributes -> Product, open SKU and check Use in Search on the Storefront Properties tab.
-
Navigate to System -> Search Management -> Search indexes, open the Product index, and check that SKU is listed in Searchable attributes, its Weight and its Wildcard value. In Properties, check Search by child products.
-
Navigate to Stores -> Configuration -> Mirasvit extensions -> Search ultimate -> Query handling and processing and check Wildcard search, Wildcard exceptions and Long-tail search expressions.
-
Use the Search results validator: enter the SKU in Search term to see which products match, or the product ID in Entity ID to see whether the product is visible in search.
-
If the storefront search returns nothing for every query, look for
Cannot search on fieldinvar/log/exception.log. If you find it, check your extension version.
How to fix it
-
Make SKU searchable. Set Use in Search to Yes for the SKU attribute and add SKU to Searchable attributes of the Product index with a high weight (up to 10).
-
Allow partial SKU search. Set Wildcard search to Enabled (*word*), or set the Wildcard value only for the SKU attribute in the Product index if you want other attributes to keep stricter matching. Remove SKU fragments from Wildcard exceptions.
-
Handle separators. Add a Long-tail search expressions rule that removes dashes, slashes or spaces, so all variants of the SKU match. See How to configure long-tail search for ready-made rules.
-
Find parents by child SKU. Enable Search by child products in Properties of the Product index. The child SKUs and searchable values are added to the parent product, so a search for a child SKU returns the parent.
-
Upgrade if the version is old. The fix for
Cannot search on field [sku]is in 2.8.0, and the SKU spell correction fixes are in 2.3.14 and 2.8.4. See How to upgrade extension. -
Reindex. Run a full reindex after any change above:
bin/magento indexer:reindex catalogsearch_fulltext
Checklist
- Enable fast mode is off, or a full reindex was run after the last change to indexes or products.
- The missing product is within Max number of results, or the limit is raised.
- You compare autocomplete with the results page without filters, with the Relevance sort, in the same store view.
- Use in Search is on for SKU, and SKU is in Searchable attributes of the Product index.
- Wildcard search (global or for SKU) matches the part of the SKU customers type.
- A Long-tail search expressions rule covers SKUs with dashes, slashes or spaces.
- Search by child products is on if customers search by child SKUs.
- The extension is version 2.8.0 or later.
- The Search results validator finds the product for the query.
These settings are part of Search Ultimate for Magento 2.