Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(recommendations): add "quantity" param to similars resolver #128

Conversation

pedrobernardina
Copy link

What problem is this solving?

  • Create parameter quantity on Recommendation.similars resolver;
  • Create parameter groupByProduct on productRecommendations query

These are necessary for the resolver to return more than 12 similar products.

In the Fashion segments it's common to have different product colours as different (similar) products instead of SKUs due to the limited number of SKUs we can have on the platform. There's a limitation in the current implementation that caps the number of similar products to 12, forcing us to make extra API calls.

This feature is backwards compatible and there's also an MR in vtex.search-resolver that implements the necessary changes.

How should this be manually tested?

GraphQL IDE on the following Workspace

Example Queries

query ProductRecommendations(
  $identifier: ProductUniqueIdentifier
  $type: CrossSelingInputEnum
  $groupByProduct: Boolean
) {
  productRecommendations(identifier: $identifier, type: $type, groupByProduct: $groupByProduct) {
    cacheId
    productId
    productName
    productReference
  }
}
{
  "identifier": {
    "field": "id",
    "value": "177"
  },
  "type": "similars",
  "groupByProduct": true  // true is the default value. This is optional
}
query ProductsByIdentifier(
  $field: ProductUniqueIdentifierField!
  $values: [ID!]
) {
  productsByIdentifier(field: $field, values: $values) {
    cacheId
    productId
    productName
    productReference
    recommendations {
      similars(quantity: DEFAULT) { # DEFAULT or ALL_AVAILABLE
        cacheId
      	productId
    		productName
    		productReference
      }
    }
  }
}
{
  "field": "id",
  "values": [21, 177]
}

Checklist/Reminders

  • Updated README.md.
  • Updated CHANGELOG.md.
  • Linked this PR to a Clubhouse story (if applicable).
  • Updated/created tests (important for bug fixes).
  • Deleted the workspace after merging this PR (if applicable).

Screenshots or example usage

Type of changes

✔️ Type of Change
_ Bug fix
✔️ New feature
_ Breaking change
_ Technical improvements

Notes

@pedrobernardina pedrobernardina requested a review from a team as a code owner August 9, 2023 21:32
@vtex-io-ci-cd
Copy link

vtex-io-ci-cd bot commented Aug 9, 2023

Hi! I'm VTEX IO CI/CD Bot and I'll be helping you to publish your app! 🤖

Please select which version do you want to release:

  • Patch (backwards-compatible bug fixes)

  • Minor (backwards-compatible functionality)

  • Major (incompatible API changes)

And then you just need to merge your PR when you are ready! There is no need to create a release commit/tag.

  • No thanks, I would rather do it manually 😞

@vtex-io-docs-bot
Copy link

Beep boop 🤖

Thank you so much for keeping our documentation up-to-date ❤️

@iago1501
Copy link
Contributor

Folks, we are going to follow the changes on these 3 PRs:

vtex-apps/shelf#282
#135
vtex-apps/search-resolver#467

Suggest you review, do your tests, and check if they look good for you, basically, I just made a change removing the responsibility of the type of recommendation and adding this responsibility into the recommendation itself, we are going to review here internally and do all merge and deploy process

@iago1501 iago1501 closed this Mar 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants