You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to search for resource records based on the values of an associated model's attributes.
Say I have a resource/model Order that has many Suborders. When search for Orders, I'd like for it search against both the id attributes of Order and Suborder, and return any orders for that have a matching id for either Order or Suborder. If I perform a search against Orders with a term of '11', I'd expect it to return Orders with an id of 11 as well Orders having a Suborder with an id of 11.
I've been reading through the code and tried to make a derivative HasMany field that's searchable, but get an error with the generated query that orders.sub_orders doesn't exist, which is correct since it's Suborder that holds the foreign key.
Is there any way to configure a resource's search so that it can search against both its attributes and its assocations?
Thanks!
The text was updated successfully, but these errors were encountered:
Search is just a simple SQL query builder currently. I'd love to be able to add an easy method for adding joins to allow querying against associated tables.
I'd also love the ability to swap the search out with other implementations like Meilisearch, ElasticSearch.
Currently, you can override scoped_resources in the resource controller to do this. Pagy does work differently for various search engines, so that piece may also need customization.
I want to search for resource records based on the values of an associated model's attributes.
Say I have a resource/model Order that has many Suborders. When search for Orders, I'd like for it search against both the id attributes of Order and Suborder, and return any orders for that have a matching id for either Order or Suborder. If I perform a search against Orders with a term of '11', I'd expect it to return Orders with an id of 11 as well Orders having a Suborder with an id of 11.
I've been reading through the code and tried to make a derivative HasMany field that's searchable, but get an error with the generated query that
orders.sub_orders
doesn't exist, which is correct since it's Suborder that holds the foreign key.Is there any way to configure a resource's search so that it can search against both its attributes and its assocations?
Thanks!
The text was updated successfully, but these errors were encountered: