Storefront search is based on query parameters that determine what information is returned, and how it’s returned, in the search results. In addition to the search query itself, there are parameters that allow you to customize the search in the following ways:
- Only search for certain resource types
- Choose whether unavailable products are returned, and where in the results
- Enable partial word matches
Search queries accept the following parameters:
||String||Yes||The search query.|
Specifies the type of results requested. The possible options are:
Defaults to all types.
||Integer||No||Specifies the current search results page. Defaults to
Specifies search options that you can customize with the
Specifies whether to display results for unavailable products. The possible options are:
Specifies whether we want to perform a partial word match on the last search term.
For example, if "winter snow" is used as a search query, a search will find all applicable resources that contain both "winter" and any term that starts with "snow". This could be terms like "snow", "snowshoe", or "snowboard".
The possible options are:
The search form
The search form can be included with a
<form> element that has an attribute of
action="/search". Inside the form, you can include inputs for each of the query parameters above, where each input has the following attributes:
Aside from the
q parameter, none of the query parameters require user input, so should be hidden inputs.
Search URL structure
When a search is performed, the search page’s URL is updated to reflect that. The general format is: