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

Support find_all with an array of IDs #187

Open
gburgett opened this issue Oct 18, 2019 · 0 comments
Open

Support find_all with an array of IDs #187

gburgett opened this issue Oct 18, 2019 · 0 comments

Comments

@gburgett
Copy link
Member

Algolia rails gem provides the ability to search activemodel records like this:

Person.search('some query')

The way this works is, when the hits come back, it gets an array of all the IDs and then passes them to a call to .where(id: array_of_ids). Our ActiveRecordShim passes this through to find_all, which via the CDNAdapter results in this error:

WCC::Contentful::SimpleClient::ApiError
AlgoliaSyncJob@default
The query you sent included duplicate URI query parameters. Please specify each URI query parameter only once and separate multiple values with a comma, e.g. "order=foo,bar".
Duplicates were: sys.id[]
Oct 18th, 2019, 14:02:15 UTC

STACKTRACE

vendor/bundle/ruby/2.5.0/bundler/gems/wcc-contentful-bcf4a6c6cc88/wcc-contentful/lib/wcc/contentful/simple_client/response.rb:68:in `assert_ok!': The query you sent included duplicate URI query parameters. Please specify each URI query parameter only once and separate multiple values with a comma, e.g. "order=foo,bar".
Duplicates were: sys.id[] (WCC::Contentful::SimpleClient::ApiError)
    from vendor/bundle/ruby/2.5.0/bundler/gems/wcc-contentful-bcf4a6c6cc88/wcc-contentful/lib/wcc/contentful/simple_client.rb:170:in `entries'
    from vendor/bundle/ruby/2.5.0/bundler/gems/wcc-contentful-bcf4a6c6cc88/wcc-contentful/lib/wcc/contentful/store/cdn_adapter.rb:108:in `response'
    from vendor/bundle/ruby/2.5.0/bundler/gems/wcc-contentful-bcf4a6c6cc88/wcc-contentful/lib/wcc/contentful/store/cdn_adapter.rb:56:in `to_enum'
    from vendor/bundle/ruby/2.5.0/bundler/gems/wcc-contentful-bcf4a6c6cc88/wcc-contentful/lib/wcc/contentful/store/base.rb:112:in `map'
    from vendor/bundle/ruby/2.5.0/bundler/gems/wcc-contentful-bcf4a6c6cc88/wcc-contentful/lib/wcc/contentful/model_singleton_methods.rb:36:in `find_all'
    from vendor/bundle/ruby/2.5.0/bundler/gems/wcc-contentful-bcf4a6c6cc88/wcc-contentful/lib/wcc/contentful/active_record_shim.rb:69:in `where'
    from vendor/bundle/ruby/2.5.0/gems/algoliasearch-rails-1.23.2/lib/algoliasearch-rails.rb:715:in `algolia_search'

@gburgett gburgett added the core label Apr 16, 2021
@zube zube bot removed the core label Jan 31, 2023
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

No branches or pull requests

1 participant