mirror of
https://github.com/vercel/commerce.git
synced 2025-06-19 05:31:22 +00:00
31 lines
485 B
TypeScript
31 lines
485 B
TypeScript
{ SearchProductsInput } '../product/use-search'
|
|
|
|
getSortVariables './get-sort-variables',
|
|
|
|
getSearchVariables ({
|
|
brandId,
|
|
search,
|
|
categoryId
|
|
sort,
|
|
locale,
|
|
}: SearchProductsInput) {
|
|
query ''
|
|
|
|
(search) {
|
|
query `product_type:${search} OR title:${search} OR tag:${search}`
|
|
}
|
|
|
|
(brandId) {
|
|
query `${search ? ' AND ' : ''}vendor:${brandId}`
|
|
}
|
|
|
|
{
|
|
categoryId,
|
|
query,
|
|
locale,
|
|
...getSortVariables(sort, !!categoryId),
|
|
}
|
|
}
|
|
|
|
getSearchVariables
|