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

[bug]: broken Recommend API #506

Closed
antonhalim opened this issue Oct 8, 2024 · 1 comment · Fixed by algolia/api-clients-automation#3936
Closed

[bug]: broken Recommend API #506

antonhalim opened this issue Oct 8, 2024 · 1 comment · Fixed by algolia/api-clients-automation#3936

Comments

@antonhalim
Copy link

Description

I'm just following the doc in https://www.algolia.com/doc/libraries/ruby/v3/methods/recommend/get-recommendations/, but nothing seems to work and forcing us to revert to previous version.

require "algolia"

client = Algolia::RecommendClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")

response = client.get_recommendations(
  GetRecommendationsParams.new(
    requests: [
      RelatedQuery.new(
        index_name: "ALGOLIA_INDEX_NAME",
        object_id: "objectID",
        model: "related-products",
        threshold: 42.1
      )
    ]
  )
)

This breaks and gave me error: NameError: uninitialized constant GetRecommendationsParams, so I figured I'd use the full class name:

response = client.get_recommendations(
  Algolia::Recommend::GetRecommendationsParams.new(
    requests: [
      Algolia::Recommend::RelatedQuery.new(
        index_name: "ALGOLIA_INDEX_NAME",
        object_id: "objectID",
        model: "related-products",
        threshold: 42.1
      )
    ]
  )
)

This would error:

ArgumentError: invalid value for "hits_per_page", must be greater than or equal to 1.
from /Users/username/.gem/ruby/3.3.2/gems/algolia-3.4.0/lib/algolia/models/recommend/recommendations_results.rb:397:in `hits_per_page='

Client

Recommend

Version

3.4.0

Relevant log output

No response

@millotp
Copy link
Contributor

millotp commented Oct 9, 2024

Hello, both of your issues will be fixed in the next release, thanks for reporting !

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 a pull request may close this issue.

2 participants