Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion node/resolvers/sponsoredProducts/newtail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export async function newtailSponsoredProducts(
const context = args?.query?.length ? 'search' : (categoryName ? 'category' : (brandName ? 'brand_page' : 'home'))

const tags = args.selectedFacets
?.filter((facet) => facet.key?.toLowerCase() === PRODUCT_CLUSTER_MAP)
?.filter((facet) => PRODUCT_CLUSTER_MAP.includes(facet.key?.toLowerCase()))
.map((facet) => `product_cluster/${facet.value}`)
;

Expand Down
2 changes: 1 addition & 1 deletion node/utils/constants.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export const RELEVANCE_DESC_SORT_STR = 'orderbyscoredesc'
export const PRODUCT_CLUSTER_MAP = 'productclusterids'
export const PRODUCT_CLUSTER_MAP = ['productclusterids', 'productclusternames']
export const BRAND_FACET_KEYS = ['b', 'brand']
4 changes: 2 additions & 2 deletions node/utils/shouldFetchSponsoredProducts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ const isSortedByRelevance = (args: SearchParams) => {
}

const queryHasProductClusters = (args: SearchParams) => {
const mapHasProductClusters = args.map?.toLowerCase() === PRODUCT_CLUSTER_MAP
const mapHasProductClusters = PRODUCT_CLUSTER_MAP.includes(args.map?.toLowerCase() ?? '')
const facetsHaveProductClusters = args.selectedFacets?.some(
(facet) => facet.key?.toLowerCase() === PRODUCT_CLUSTER_MAP
(facet) => PRODUCT_CLUSTER_MAP.includes(facet.key?.toLowerCase())
)

return mapHasProductClusters || facetsHaveProductClusters
Expand Down