binarylogic / searchlogic

Searchlogic provides object based searching, common named scopes, and other useful tools.
http://rdoc.info/projects/binarylogic/searchlogic
MIT License
1.39k stars 133 forks source link

Date search must be applied first #110

Open apolzon opened 14 years ago

apolzon commented 14 years ago

I've noticed an inconsistency in how searchlogic handles doing a date search (my example uses created_at).

Model.created_at_in("2007-8-9".."2010-8-9").another_scope.count => small number Model.another_scope.created_at_in("2007-8-9".."2010-8-9").count => all records in that date range

I ran into this using the Model.search(params) feature, where I can't (as far as I know) control the order the scopes are applied.

Thanks.

apolzon commented 14 years ago

Upon working further through my code, I'm realizing that maybe the "issue" is that Model.search always OR's the scopes. Is there a way to force searchlogic to do AND queries?