---
title: "predictiveSearch"
description: "预测搜索结果数组"
doc_type: graphql
doc_category: storefront
doc_version: v20270301
source_url:
  html: 'https://developer.shopline.com/zh-hans-cn/docs/storefront-api/products/queries/predictive-search'
  md: 'https://developer.shopline.com/zh-hans-cn/docs/storefront-api/products/queries/predictive-search.md'
---
# predictiveSearch

预测搜索结果数组

- **API Version:** v20270301
- **API Type:** Storefront
- **API Protocol:** GraphQL
- **Operation Type:** Query

## Type Signature

`PredictiveSearchResult`

## Arguments

* `query`

  [String!](https://developer.shopline.com/zh-hans-cn/docs/storefront-api/common/scalars/string.md)

  搜索词

* `limit`

  [Int](https://developer.shopline.com/zh-hans-cn/docs/storefront-api/common/scalars/int.md)

  结果数量限制在 1 到 10 范围内，默认值为 10

## Returns

* `products`

  [[Product]](https://developer.shopline.com/zh-hans-cn/docs/storefront-api/products/objects/product.md)

  与搜索查询匹配的产品

* `queries`

  [[SearchQuerySuggestion!]](https://developer.shopline.com/zh-hans-cn/docs/storefront-api/products/objects/search-query-suggestion.md)

  与搜索查询相关的查询建议

## Code Example

```graphql
 {
	predictiveSearch(query, limit ) 
		 {
			# PredictiveSearchResult fields
		}
}
```

## Error Handling

关于更多通用错误码说明，参考：[状态码和错误码](https://developer.shopline.com/zh-hans-cn/docs/apps/api-instructions-for-use/storefront-api/overview.md#status-and-error-codes)。

