Skip to content

Conversation

camel2243
Copy link

Q A
Bug fix? yes
New feature? no
BC breaks? no
Related Issue Fix #469
Need Doc update no

Describe your change

Fix the incorrect opts passed to get_objects

What problem is this fixing?

When passing opts: attributesToRetrieve to get_objects we receive an excpetion that attributesToRetrieve is an invalid key. attributesToRetrieve is supported in request_options, not in opts.

Here is the proof:

[1] pry(#<Algolia::Search::Index>)> opts
=> {:attributesToRetrieve=>"id"}

[2] pry(#<Algolia::Search::Index>)> @transporter.read(:POST, '/1/indexes/*/objects', { 'requests': requests }, opts)
Algolia::AlgoliaHttpError: invalid key 'attributesToRetrieve'. Expected: appID, apiKey, requests, allowNestedFacets (near 1:112)
from /Users/camel/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/algolia-2.3.4/lib/algolia/transport/transport.rb:74:in `block in request'

[3] pry(#<Algolia::Search::Index>)> @transporter.read(:POST, '/1/indexes/*/objects', { 'requests': requests }, {})
=> {:results=>[{:id=>1, :objectID=>"1"}]}

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.

get_objects fails when passing in attributesToRetrieve
1 participant