Skip to content

Commit

Permalink
Merge pull request #6342 from artsy/staging
Browse files Browse the repository at this point in the history
Deploy
  • Loading branch information
joeyAghion authored Jan 10, 2025
2 parents 75893fe + 4f5e74c commit 5596769
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
6 changes: 6 additions & 0 deletions _schemaV2.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -16922,6 +16922,9 @@ type Query {
before: String
certainty: Float

# The number of curated artworks to return. This is a temporary field to support the transition to OpenSearch
curatedPicksSize: Int = 2

# (Only for when useOpenSearch is true) Exclude these artworks from the response
excludeArtworkIds: [String]
first: Int
Expand Down Expand Up @@ -21576,6 +21579,9 @@ type Viewer {
before: String
certainty: Float

# The number of curated artworks to return. This is a temporary field to support the transition to OpenSearch
curatedPicksSize: Int = 2

# (Only for when useOpenSearch is true) Exclude these artworks from the response
excludeArtworkIds: [String]
first: Int
Expand Down
4 changes: 3 additions & 1 deletion src/data/complete.queryMap.json
Original file line number Diff line number Diff line change
Expand Up @@ -7797,5 +7797,7 @@
"58b02d547ef42f2758cce97736a95a54": "query OrderHistoryTestsQuery(\n $count: Int!\n) {\n me {\n ...OrderHistory_me_yu5n1\n id\n }\n}\n\nfragment OrderHistoryRow_order on CommerceOrder {\n __isCommerceOrder: __typename\n internalID\n displayState\n mode\n buyerTotal(precision: 2)\n createdAt\n itemsTotal\n lineItems(first: 1) {\n edges {\n node {\n shipment {\n trackingUrl\n trackingNumber\n id\n }\n artworkVersion {\n image {\n resized(width: 55) {\n url\n }\n blurhash\n }\n id\n }\n artwork {\n partner {\n name\n id\n }\n title\n artistNames\n id\n }\n fulfillments(first: 1) {\n edges {\n node {\n trackingId\n id\n }\n }\n }\n id\n }\n }\n }\n ... on CommerceOfferOrder {\n buyerAction\n }\n}\n\nfragment OrderHistory_me_yu5n1 on Me {\n orders(first: $count, states: [APPROVED, CANCELED, FULFILLED, REFUNDED, SUBMITTED, PROCESSING_APPROVAL]) {\n edges {\n node {\n __typename\n code\n ...OrderHistoryRow_order\n id\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n}\n",
"921bdaf8e95d8829a1395430a823c019": "query OrderHistoryQuery(\n $count: Int!\n) {\n me @optionalField {\n name\n ...OrderHistory_me_yu5n1\n id\n }\n}\n\nfragment OrderHistoryRow_order on CommerceOrder {\n __isCommerceOrder: __typename\n internalID\n displayState\n mode\n buyerTotal(precision: 2)\n createdAt\n itemsTotal\n lineItems(first: 1) {\n edges {\n node {\n shipment {\n trackingUrl\n trackingNumber\n id\n }\n artworkVersion {\n image {\n resized(width: 55) {\n url\n }\n blurhash\n }\n id\n }\n artwork {\n partner {\n name\n id\n }\n title\n artistNames\n id\n }\n fulfillments(first: 1) {\n edges {\n node {\n trackingId\n id\n }\n }\n }\n id\n }\n }\n }\n ... on CommerceOfferOrder {\n buyerAction\n }\n}\n\nfragment OrderHistory_me_yu5n1 on Me {\n orders(first: $count, states: [APPROVED, CANCELED, FULFILLED, REFUNDED, SUBMITTED, PROCESSING_APPROVAL]) {\n edges {\n node {\n __typename\n code\n ...OrderHistoryRow_order\n id\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n}\n",
"98e23cdb77cf6526870ea053124a23d7": "query OrderHistoryRowTestsQuery {\n commerceOrder(id: \"some-id\") {\n __typename\n ...OrderHistoryRow_order\n id\n }\n}\n\nfragment OrderHistoryRow_order on CommerceOrder {\n __isCommerceOrder: __typename\n internalID\n displayState\n mode\n buyerTotal(precision: 2)\n createdAt\n itemsTotal\n lineItems(first: 1) {\n edges {\n node {\n shipment {\n trackingUrl\n trackingNumber\n id\n }\n artworkVersion {\n image {\n resized(width: 55) {\n url\n }\n blurhash\n }\n id\n }\n artwork {\n partner {\n name\n id\n }\n title\n artistNames\n id\n }\n fulfillments(first: 1) {\n edges {\n node {\n trackingId\n id\n }\n }\n }\n id\n }\n }\n }\n ... on CommerceOfferOrder {\n buyerAction\n }\n}\n",
"a738b0cfd972cbb7581e3489df7040b4": "query OrderHistoryPaginationQuery(\n $count: Int!\n $cursor: String\n $states: [CommerceOrderStateEnum!]\n) {\n me {\n ...OrderHistory_me_a4QoT\n id\n }\n}\n\nfragment OrderHistoryRow_order on CommerceOrder {\n __isCommerceOrder: __typename\n internalID\n displayState\n mode\n buyerTotal(precision: 2)\n createdAt\n itemsTotal\n lineItems(first: 1) {\n edges {\n node {\n shipment {\n trackingUrl\n trackingNumber\n id\n }\n artworkVersion {\n image {\n resized(width: 55) {\n url\n }\n blurhash\n }\n id\n }\n artwork {\n partner {\n name\n id\n }\n title\n artistNames\n id\n }\n fulfillments(first: 1) {\n edges {\n node {\n trackingId\n id\n }\n }\n }\n id\n }\n }\n }\n ... on CommerceOfferOrder {\n buyerAction\n }\n}\n\nfragment OrderHistory_me_a4QoT on Me {\n orders(first: $count, after: $cursor, states: $states) {\n edges {\n node {\n __typename\n code\n ...OrderHistoryRow_order\n id\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n}\n"
"a738b0cfd972cbb7581e3489df7040b4": "query OrderHistoryPaginationQuery(\n $count: Int!\n $cursor: String\n $states: [CommerceOrderStateEnum!]\n) {\n me {\n ...OrderHistory_me_a4QoT\n id\n }\n}\n\nfragment OrderHistoryRow_order on CommerceOrder {\n __isCommerceOrder: __typename\n internalID\n displayState\n mode\n buyerTotal(precision: 2)\n createdAt\n itemsTotal\n lineItems(first: 1) {\n edges {\n node {\n shipment {\n trackingUrl\n trackingNumber\n id\n }\n artworkVersion {\n image {\n resized(width: 55) {\n url\n }\n blurhash\n }\n id\n }\n artwork {\n partner {\n name\n id\n }\n title\n artistNames\n id\n }\n fulfillments(first: 1) {\n edges {\n node {\n trackingId\n id\n }\n }\n }\n id\n }\n }\n }\n ... on CommerceOfferOrder {\n buyerAction\n }\n}\n\nfragment OrderHistory_me_a4QoT on Me {\n orders(first: $count, after: $cursor, states: $states) {\n edges {\n node {\n __typename\n code\n ...OrderHistoryRow_order\n id\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n}\n",
"5298c68273523cdfe3b81c9da74d45be": "query validatePhoneNumberQuery(\n $phoneNumber: String!\n $regionCode: String\n) {\n phoneNumber(phoneNumber: $phoneNumber, regionCode: $regionCode) {\n isValid\n }\n}\n",
"554499772693a16343b015d6b5dd68f5": "query InfiniteDiscoveryQuery {\n marketingCollection(slug: \"curators-picks\") {\n artworksConnection(first: 10) {\n edges {\n node {\n artistNames\n artists(shallow: true) {\n coverArtwork {\n images {\n url(version: \"small\")\n }\n id\n }\n formattedNationalityAndBirthday\n initials\n id\n }\n date\n internalID\n images {\n url(version: \"large\")\n }\n saleMessage\n title\n id\n }\n }\n id\n }\n id\n }\n}\n"
}
15 changes: 11 additions & 4 deletions src/schema/v2/infiniteDiscovery/discoverArtworks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@ export const DiscoverArtworks: GraphQLFieldConfig<void, ResolverContext> = {
"(Only for when useOpenSearch is true) Weights for the OpenSearch query",
defaultValue: [0.6, 0.4],
},
curatedPicksSize: {
type: GraphQLInt,
description:
"The number of curated artworks to return. This is a temporary field to support the transition to OpenSearch",
defaultValue: 2,
},
}),
resolve: async (
_root,
Expand All @@ -97,6 +103,7 @@ export const DiscoverArtworks: GraphQLFieldConfig<void, ResolverContext> = {
useOpenSearch,
mltFields,
osWeights,
curatedPicksSize,
} = args

if (useOpenSearch) {
Expand Down Expand Up @@ -127,13 +134,13 @@ export const DiscoverArtworks: GraphQLFieldConfig<void, ResolverContext> = {
}

result = await findSimilarArtworks(options, artworksLoader)

// use first 8 artworks
result = result.slice(0, 8)
result = result.slice(0, limit - curatedPicksSize)

// backfill with random curated picks if we don't have enough similar artworks
const randomArtworks = await getInitialArtworksSample(
2,
limit - result.length === curatedPicksSize
? curatedPicksSize
: limit - result.length,
excludeArtworkIds,
artworksLoader
)
Expand Down

0 comments on commit 5596769

Please sign in to comment.