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

Request to make dom_id (Rails helper) work with Searchkick option load: false #1703

Open
jbwl opened this issue Jan 23, 2025 · 0 comments
Open

Comments

@jbwl
Copy link

jbwl commented Jan 23, 2025

Is your feature request related to a problem? Please describe.
Hotwire / Turbo relies on unique dom ids. Rails has a dom_id helper method which simplifies getting a dom id for a given ActiveRecord object.

  • When the load: option is true, Searchkick instantiates the actual AR objects so the dom_id helper works with a result object

  • But when the load: option is false, the search results are not the underlying AR object, therefore do not respond to param_key and can't be used with the dom_id helper.

Describe the solution you'd like
To be able to use the Searchkick results in a modern rails app but still be able to use the indexed data only without load: true, I would like to be able to have a Searchkick result object be compatible with the dom_id helper method. If this means adding more fields and a class name, etc. to the Searchkick index, that'd be fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant