You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/pages/graphql/schema/live-search/queries/product-search.md
+34-2Lines changed: 34 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -555,9 +555,25 @@ The `items` object can also optionally return highlighted text that shows the ma
555
555
The query response can also contain the following top-level fields and objects:
556
556
557
557
-`page_info` - An object that lists the `page_size` and `current_page` input arguments and the total number of pages available.
558
-
-`suggestions` - An array of strings that include the names of products and categories that exist in the catalog that are similar to the search query.
558
+
-`suggestions` - An array of strings that include the names of products and categories that exist in the catalog that are similar to the search query. See **Logic used for `suggestions`** to learn more.
559
559
-`total_count` - The number of products returned.
560
560
561
+
**Logic used for `suggestions`**
562
+
563
+
- Data from name and category path fields are used.
564
+
- Name: `Supernova Sport Pant` will be stored in three phrases:
565
+
-`Supernova Sport Pant`
566
+
-`Sport Pant`
567
+
-`Pant`
568
+
- Category path: tokenized by /, so "products/electronics/mobiles-and-accessories" will be stored as:
569
+
-`products`
570
+
-`electronics`
571
+
-`mobiles-and-accessories`
572
+
573
+
When a search is made, the "suggestion" field is searched using a "prefix" based search and the matching phrase is returned.
574
+
575
+
**Example** - If "sport" is searched, then "sport pant" will be one suggestion.
576
+
561
577
## Endpoints
562
578
563
579
import StorefrontAPIEndpoints from '/src/_includes/graphql/endpoints.md'
@@ -906,9 +922,25 @@ Field | Data Type | Description
906
922
`items` | [[ProductSearchItem]](#productsearchitem-data-type) | An array of products returned by the query
907
923
`page_info` | [SearchResultPageInfo](#searchresultpageinfo-data-type) | Contains information for rendering pages of search results
908
924
`related_terms` | [String] | Reserved for future use
909
-
`suggestions` | [String] | An array of product URL keys that are similar to the search query. A maximum of five items are returned
925
+
`suggestions` | [String] | An array of product URL keys that are similar to the search query. A maximum of five items are returned. See **Logic used for `suggestions`** to learn more.
910
926
`total_count` | Int | The total number of items returned
911
927
928
+
**Logic used for `suggestions`**
929
+
930
+
- Data from name and category path fields are used.
931
+
- Name: `Supernova Sport Pant` will be stored in three phrases:
932
+
-`Supernova Sport Pant`
933
+
-`Sport Pant`
934
+
-`Pant`
935
+
- Category path: tokenized by /, so "products/electronics/mobiles-and-accessories" will be stored as:
936
+
-`products`
937
+
-`electronics`
938
+
-`mobiles-and-accessories`
939
+
940
+
When a search is made, the "suggestion" field is searched using a "prefix" based search and the matching phrase is returned.
941
+
942
+
**Example** - If "sport" is searched, then "sport pant" will be one suggestion.
0 commit comments