mirror of
https://github.com/vercel/commerce.git
synced 2025-05-19 07:56:59 +00:00
add searchQuery
Signed-off-by: Loan Laux <loan@outgrow.io>
This commit is contained in:
parent
6f0dfb78f3
commit
76bb0c7e5d
@ -7,15 +7,15 @@ export const getSearchVariables = ({
|
||||
categoryId,
|
||||
sort,
|
||||
}: SearchProductsInput) => {
|
||||
let query = ''
|
||||
let searchQuery = ''
|
||||
let tagIdsParam = {}
|
||||
|
||||
if (search) {
|
||||
query += `product_type:${search} OR title:${search} OR tag:${search}`
|
||||
searchQuery += search
|
||||
}
|
||||
|
||||
if (brandId) {
|
||||
query += `${search ? ' AND ' : ''}vendor:${brandId}`
|
||||
searchQuery += `${search ? ' ' : ''}${brandId}`
|
||||
}
|
||||
|
||||
if (categoryId) {
|
||||
@ -25,8 +25,7 @@ export const getSearchVariables = ({
|
||||
}
|
||||
|
||||
return {
|
||||
// categoryId,
|
||||
// query,
|
||||
searchQuery,
|
||||
...tagIdsParam,
|
||||
...getSortVariables(sort, !!categoryId),
|
||||
}
|
||||
|
@ -49,6 +49,7 @@ catalogItems(
|
||||
sortBy: $sortBy
|
||||
tagIds: $tagIds
|
||||
shopIds: $shopIds
|
||||
searchQuery: $searchQuery
|
||||
) {
|
||||
${catalogItemsConnection}
|
||||
}
|
||||
@ -60,6 +61,7 @@ const catalogItemsQuery = /* GraphQL */ `
|
||||
$sortBy: CatalogItemSortByField = updatedAt
|
||||
$tagIds: [ID]
|
||||
$shopIds: [ID]!
|
||||
$searchQuery: String
|
||||
) {
|
||||
${catalogItemsFragment}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user