---
title: "search"

doc_type: graphql
doc_category: storefront
doc_version: v20270301
source_url:
  html: 'https://developer.shopline.com/zh-hans-cn/docs/storefront-api/products/queries/search'
  md: 'https://developer.shopline.com/zh-hans-cn/docs/storefront-api/products/queries/search.md'
---
# search

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

## Type Signature

`SearchResultItemConnection`

## Arguments

* `productFilters`

  [[ProductFilterInput]](https://developer.shopline.com/zh-hans-cn/docs/storefront-api/products/inputs/product-filter-input.md)

  返回与所有商品过滤器匹配的商品子集，输入包含的值不得超过 250 个

* `rawQuery`

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

  搜索内容

* `after`

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

  返回指定游标之后的元素。如果指定了该参数，也必须要指定 `first` 参数。

* `before`

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

  返回指定游标之前的元素。如果指定了该参数，也必须要指定 `last` 参数。

* `first`

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

  返回列表中的前 n 个元素。

* `last`

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

  返回列表中的最后 n 个元素。

* `reverse`

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

  是否反转列表的顺序。
  
  ● true：反转
  
  ● false：不反转
  
  默认值：false

* `sortKey`

  [SearchSortKeys](https://developer.shopline.com/zh-hans-cn/docs/storefront-api/products/enums/search-sort-keys.md)

  按给定键对基础列表进行排序

## Returns

* `edges`

  [[SearchResultItemEdge!]](https://developer.shopline.com/zh-hans-cn/docs/storefront-api/products/objects/search-result-item-edge.md)

  边缘列表

* `nodes`

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

  SearchResultItemEdge 中包含的节点列表

* `pageInfo`

  [PageInfo!](https://developer.shopline.com/zh-hans-cn/docs/storefront-api/online-store/objects/page-info.md)

  帮助分页的信息

* `productFilters`

  [[Filter]](https://developer.shopline.com/zh-hans-cn/docs/storefront-api/common-objects/objects/filter.md)

  可用的过滤器列表

* `totalCount`

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

  结果总数

## Code Example

```graphql
 {
	search(productFilters, rawQuery, after, before, first, last, reverse, sortKey ) 
		 {
			# SearchResultItemConnection fields
		}
}
```

## Error Handling

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

