Search and discovery are essential components of any successful online store. They help customers find the products they’re looking for. Using the Storefront API, you can build a storefront search and product recommendations, and create a tailored shopping experience for customers.

This guide introduces you to creating your own storefront search experience with the [Storefront API](/docs/api/storefront).

## How it works

You can use the Storefront API to complete the following tasks related to search and discovery:

- **[Storefront search](#storefront-search)**: Surface the most relevant results in your store with Shopify’s AI-powered search.
- **[Predictive search](#predictive-search)**: Provide customers with a typeahead search and suggestions feature in your custom storefront.
- **[Filters and facets](#filters-and-facets)**: Use faceted filtering to filter products that interest customers the most.
- **[Track search analytics](#track-search-analytics)**: Access valuable analytics data related to search. You can track metrics such as search terms, click-through rates, and conversion rates to gain insights into customer behavior and optimize your store’s performance.

## Storefront search

The [`search`](/docs/api/storefront/latest/queries/search) query returns the most relevant search results for customers using machine learning and natural language processing techniques. Storefront search supports the following features:

- **Typo tolerance**: Search results for misspelled terms.
- **Partial match**: Yield relevant results for general search queries.
- **Tolerance for no results**: Display relevant products to avoid no search results.
- **Buyability prediction**: Search results based on clicks and likelihood to convert.
- **Advanced customizations**: With the [Shopify Search & Discovery app](https://help.shopify.com/manual/online-store/search-and-discovery), you can add synonym terms and boost products in the search results.

> Tip:
> Learn more about the [behaviors applied to search terms](https://help.shopify.com/manual/online-store/storefront-search) which increase the number of relevant results.

## Predictive search

The [`predictiveSearch`](/docs/api/storefront/latest/queries/predictiveSearch) query lets customers refine their search to find what they’re looking for. Predictive search includes the following features:

- **Typeahead search**: Dynamic list of suggested search queries.
- **Resource suggestions**: Suggested collections, products, pages, and blog articles.
- **Typo tolerance**: Search results for misspelled terms.
- **Partial match**: Yield relevant results for general search queries.

> Tip:
> Learn more about predictive search patterns and behavior in the [Predictive search UX guidelines](/docs/storefronts/themes/navigation-search/search/predictive-search-ux).

## Filters and facets

The `search` query suppports [filtering on attributes](/docs/api/storefront/latest/queries/search#examples-Filter_search_results) such as availability, product type, color, or other options to find the products that interest customers the most. You can [query the available filters](/docs/api/storefront/latest/queries/search#examples-Retrieve_available_filters) for products in a search result to build faceted filtering.

> Note:
> You can create and customize filters using the [Shopify Search & Discovery app](https://help.shopify.com/manual/online-store/search-and-discovery/filters).

## Track search analytics

[Tracking search analytics](/docs/storefronts/headless/building-with-the-storefront-api/search-discovery/search-tracking) is an essential part of optimizing your store’s performance and increasing conversions. By tracking and analyzing search data, you can do the following:

- **Measure storefront performance**: Analyze top-performing search terms and how customers are navigating your store so that you can improve your store’s performance. You can access a set of reports in the [Shopify Search & Discovery app](https://help.shopify.com/manual/online-store/search-and-discovery/analytics).
- **Improve search relevance**: Shopify’s storefront search infrastructure uses product and customer interaction data to optimize your store’s performance. By tracking search analytics, Shopify’s search engine can identify search terms that are not returning relevant results and adjust search algorithms accordingly. This can help improve the relevance of search results and ensure that customers are finding the products they’re looking for.

## Developer resources

Get familiar with the Storefront API by exploring guides that cover common use cases, and the complete reference for the GraphQL Storefront API.

<div class="resource-card-grid">
  <div>
  <a class="resource-card" href="/docs/api/storefront/latest/queries/search" data-theme-mode="">
    <div class="resource-card__indicator-container"><img
     src="/assets/resource-cards/graphql"
     data-alt-src="/assets/resource-cards/graphql-dark"
     aria-hidden="true"
     class="resource-card__icon themed-image"></div>
    <h3 class="resource-card__title">
      search query
    </h3>
    <p class="resource-card__description">Consult the GraphQL Storefront API reference to learn more about the search query.</p>
  </a>
</div>

<div>
  <a class="resource-card" href="/docs/api/storefront/latest/queries/predictiveSearch" data-theme-mode="">
    <div class="resource-card__indicator-container"><img
     src="/assets/resource-cards/graphql"
     data-alt-src="/assets/resource-cards/graphql-dark"
     aria-hidden="true"
     class="resource-card__icon themed-image"></div>
    <h3 class="resource-card__title">
      predictiveSearch query
    </h3>
    <p class="resource-card__description">Consult the GraphQL Storefront API reference to learn more about the predictiveSearch query.</p>
  </a>
</div>

<div>
  <a class="resource-card" href="/docs/storefronts/headless/building-with-the-storefront-api/search-discovery/search-tracking" data-theme-mode="">
    <div class="resource-card__indicator-container"><img
     src="/assets/resource-cards/growth"
     data-alt-src="/assets/resource-cards/growth-dark"
     aria-hidden="true"
     class="resource-card__icon themed-image"></div>
    <h3 class="resource-card__title">
      Optimize your store’s performance with search tracking
    </h3>
    <p class="resource-card__description">Learn how to set up search tracking with the Storefront API and Hydrogen.</p>
  </a>
</div>

</div>


## Limitations and considerations

- The `search` and `predictiveSearch` queries are supported in the Storefront API version `2023-07` or higher.
- To take advantage of AI-powered search, you need to [set up search tracking](/docs/storefronts/headless/building-with-the-storefront-api/search-discovery/search-tracking) on your custom storefront to ensure that Shopify’s storefront search infrastructure can optimize your store’s performance based on product and buyer interaction data.

## Next steps

- Learn how to [optimize your store’s performance with search tracking](/docs/storefronts/headless/building-with-the-storefront-api/search-discovery/search-tracking).
- Customize search, filters, and product recommendations using the [Shopify Search & Discovery app](https://help.shopify.com/manual/online-store/search-and-discovery).