References
- https://help.shopify.com/en/manual/online-store/storefront-search
- https://help.shopify.com/en/manual/online-store/storefront-search/predictive-search
Introduction
The online store search is a fully featured, powerful tool for your customers to search across all of your store's products, blog posts, and pages.
Predictive search
Predictive search shows suggested results as you type. It helps your customers refine their search without being redirected to a search results page, and quickly explore your store by seeing top results for suggested search terms, products, collections, and more.
You can customize the behavior of predictive search with the Search & Discovery app from Shopify.
Requirements
For predictive search to appear on your store, it must be a feature of your published theme. Predictive search is available for any Online Store 2.0 theme, and can be added to custom storefronts using the Predictive Search API.
Your store's primary locale determines which predictive search behaviors are supported. Learn more.
Search behaviour
Predictive search can return product, page, blog post, collection, and query results.
Query results are suggested search terms that are based on the words and phrases from your product catalog, as well as from past customer searches. Choosing a query result will return a page of search results for that search term.
By default, predictive search will return query, product, collection, and page results. You can change this setting in the Search & Discovery app.
Determining relevant search results
Predictive search presents shoppers with a limited set of highly relevant results. By default, a maximum of 10 possible results are shown across all the queried result types. Because of this limit, there are typically more results available on the dedicated search results page of your store.
Search results are based on the searchable properties of the different possible result types. By default, the following properties are searched:
- Products: title, product type, variant title, and vendor
- Pages, collections, and blog articles: title
Note
Changing the results limit and searchable properties is an advanced theme customization that can be done with the Predictive Search API.
Searchable translations
Your store's content can be translated with apps like Shopify's Translate & Adapt app. By default, predictive search will compare search terms to the translated content of the following searchable properties:
- Products: title, product type, variant title, and vendor
- Pages and blog articles: title
For more information on translations and searchable properties, see the developer documention on the Predictive Search API.
Limitations
Collection suggestions are based on the store's primary language. A customer's search won't be compared to a collection's translated content.
Query suggestions are available in English only, and require both the store's primary language and the customer's online store session to be in English.
Predictive search isn't available in all languages. See the complete list of supported languages.
Search behavior
Shopify applies a number of behaviors to search terms to increase the number of relevant results.
Note
Your store's primary locale will determine which behaviors are supported. Learn more.
Singular and plural search terms
The online store search tries to match terms in both their singular and plural forms.
Searching for puppies
matches results containing "puppy" or "puppies".
Treating singular and plural terms as equivalent is an example of stemming, where a word is mapped to its common lemma (stem). Shopify's stemming also takes into account the common stem of different words.
Searching for body:leggings
matches results containing "leg" or "leggings".
If you want to search for a word based on partial pattern matching, then use prefix search.
Typo tolerance
The online store search includes typo tolerance, which finds correct matches for search terms that contain typos.
Search results include matches that differ from the search term by 1 letter or that have 2 letters in a different order. The first 4 letters of a search term need to be entered correctly for typo tolerance to take effect.
For example, search for chocollate
, will return results that have chocolate
or chocolates
in the title or description.
Typo tolerance isn't applied when searches are using search syntax in the query.
Typo tolerance isn't applied on all fields when creating search results. For example, chocollate
would not match on any product tags of blog post tags of chocolate
. The following resource fields support typo tolerance:
| Resource type | Supported fields | | -- | -- | | Products | titleproduct_typevariants.titlevendor | | Pages | authortitle | | Blog posts | authortitle |
Search syntax
Search syntax determines how search terms are treated when Shopify searches for results.
Using AND, OR and NOT operators
AND
Searching for results with the AND
operator between search terms returns results when all search terms are in the result.
By default, all search terms are treated as having AND
between them. Searching for artichoke hearts
or artichoke AND hearts
both yield results containing both "artichoke" and "hearts". Joining operators aren't necessary.
OR
Searching for results with the OR
operator between search terms returns results when any search term is a result.
Searching for artichoke OR hearts
yields results containing at least one of "artichoke" or "hearts".
NOT
Searching for results without a term can be done by prefixing the term with a minus sign (-
).
Searching for artichoke -heart
matches terms with "artichoke", but not "heart".
Prefix search
Prefix search will return results where the search term matches the beginning of other terms in results. Prefix search occurs automatically on all searches.
Searching for artich
matches terms that begin with "artich", like "artichoke". This also works on the last term of a search. Searching for artichoke hea
matches terms that begin with "artichoke hea".
Phrase search
Placing a search term between double quotes (""
) searches for that exact word or phrase in one of the searchable fields.
Searching "artichoke hearts"
matches a product with the title "Can of artichoke hearts", but not a product with the title "Canned hearts of artichoke".
Searching specific fields
Add a field name with a colon to your search term to narrow your search for that term to the specified field.
For example, searching for title:artichoke
searches for titles that include the term "artichoke".
Searching for a misspelt word won't work when searching specific fields, since search looks for an exact match. For example, searching for title:artichoqe
doesn't yield any results.
Depending on the resource you're searching for (product, page, blog post), results can be based on different searchable properties.
| Resource | Searchable properties | | -- | -- | | Products | bodyproduct_typetagtitlevariants.barcodevariants.skuvariants.titlevendor | | Pages | authorbodytitle | | Blog posts | authorbodytagtitle |
Make products, pages, and blog posts searchable
Products, pages, and blog posts need be published on your online store to be returned in search results. In addition, resource types that are hidden from search engines aren't searchable.
To make products, pages, and blog posts visible on your online store, set the following settings:
| Resource Type | Visibility settings | | -- | -- | | Product | Publish your product in the Online Store channel | | Page | Publish the page | | Blog post | Set the blog post to visible |
Hide products, pages, and blog posts from search engines and sitemaps
You can hide specific product pages, blog posts, or pages to be hidden from search engines with the following methods: * Add a custom metafield from the admin * Add customer metadata by using the API * Edit your theme code
Caution
Adding the seo.hidden
metafield hides the product, page, or blog post from sitemaps, search engines, and your online store search.
Add a custom metafield in your Shopify admin
You can add a custom metafield to a product, page, or blog post in your Shopify admin and set the value to 1
to hide the product, page, or blog post from searches and sitemaps.
Steps
- Go to Settings > Custom Data.
- Under Metafields, select the eligible page type (product, page, or blog post) that you want to hide.
- Click or tap Add definition
- Set the following fields:
- Set the Name to SEO Hidden.
- Set Namespace and key to seo.hidden.
- Click or tap Select type and select Integer. Make sure that One value is selected.
- Navigate to the product, page, or blog post that you want to hide from search engines.
- Set the value of the SEO Hidden metafield to 1.
To make the product, page, or blog post visible to searches, delete the SEO Hidden metafield value.
Customizing your search
You can customize your search results with the Search & Discovery app from Shopify. The app provides a number of search features and settings that change the behavior of your online store search.
For more advanced customizations, you can edit your theme code to change the how search results are requested. Learn more about customizing at Shopify.dev.
Grow your business
If you need help customizing search in your store, then you can hire a Shopify Partner. Learn more about hiring a Shopify Partner.
Store locale affect on search behavior
The store's primary locale affects which search behaviors you get.
Supported languages
The following table indicates which search behaviors are provided for the supported languages:
| Language | Typo tolerance | Search stemming | Trigram | | -- | -- | -- | -- | | English | ✔ | ✔ | | | French | ✔ | | | | Spanish | ✔ | | | | Portuguese (Brazil) | ✔ | | | | German | ✔ | | | | Dutch | ✔ | | | | Italian | ✔ | | | | Japanese | | ✔ | ✔ Can support Katakana, Hiragana, and Kanji | | Danish | ✔ | | | | Swedish | ✔ | | | | Portuguese (Portugal) | ✔ | | | | Finnish | ✔ | | | | Norwegian (Bokml) | ✔ | | | | Turkish | ✔ | | | | Romanian | ✔ | | | | Hungarian | ✔ | | | | Russian | ✔ | | | | Polish | ✔ | | | | Czech | ✔ | | | | Greek | ✔ | | | | Icelandic | ✔ | | | | Lithuanian | ✔ | | | | Slovenian | ✔ | | | | Slovak | ✔ | | | | Bulgarian | ✔ | | | | Vietnamese | ✔ | | | | Croatian | ✔ | | | | Indonesian | ✔ | | | | Latvian | ✔ | | | | Estonian | ✔ | | | | Serbian | ✔ | | | | Ukrainian | ✔ | | | | Catalan | ✔ | | | | Norwegian (Nynorsk) | ✔ | | | | Faroese | ✔ | | | | Portuguese | ✔ | | | | Albanian | ✔ | | | | Bosnian | ✔ | | | | Afrikaans | ✔ | | | | Macedonian | ✔ | | | | Armenian | ✔ | | | | Serbo-Croatian | ✔ | | | | Latin | ✔ | | | | Welsh | ✔ | | | | Gaelic | ✔ | | | | Moldovan | ✔ | | |
Japanese locale
The Japanese local supports search stemming and Trigram search, but doesn't support typo tolerance.
Trigram
For Katakana, Hiragana, and Kanji, search will match any consecutive sequence of at least 3 characters.
For example, you can find "アップルグリーンラップドレス" by searching for any of the following terms:
ップル
アップル
ップルグリーンラ
Kanjis can also be found in pairs of two.