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
Some parameters are used to determine pagination and don't have any effect on the filters or queries passed in, eg. per_page and page. We use logic like this on Amnesty to save some time:
1). DSL for declaring allowed parameters and their options, as a mixin that can be added to your own presenters, search classes or even controllers.
2). Abstraction for easier building of ElasticSearch queries.
So from the point of view of the param-filtering DSL it shouldn't have to care what the params are used for.
re. programatically adding ES filters like this, I'm not sure how useful it is. For example in an app of mine I sometimes use :term and other times :terms (they have different behaviours). I think it's clearer to just add filters to the query case by case.
Hmmm, they seem distinct enough to deal with entirely separately. I did think adapters would be a good way to go if it made any sense, but I'm not sure if that would just be bloat.
Our reason for programmatically declaring filters was that we had a hell of a lot of them (20 by my count, including the search field) that all behaved the same way. For us it was just a case of not wanting to repeat every parameter several times. Considering how the Tire gem works and without diving into its internals I'm not quite sure how to keep that DRY while offering some clarity :(
Some parameters are used to determine pagination and don't have any effect on the filters or queries passed in, eg.
per_page
andpage
. We use logic like this on Amnesty to save some time:Should some things have their own methods (ie. stuff that deals with pagination), or should there be an option to exclude them as actual queries?
Would it be worth having either an
ignore
option forsearch_option
, or otherwiseThe text was updated successfully, but these errors were encountered: