I am also looking for the same functionality. Chris, your solution
works with a complete match, but it'd be nice to have the
functionality of 'any!'.
For instance...
User.username_like_any("bjohnson", "thunt").email_like_any("bjohnson",
"thunt") gets:
SELECT * FROM `users` WHERE ((user.username LIKE '%bjohnson%' OR
user.username LIKE '%thunt%') AND (user.email LIKE '%bjohnson%' OR
user.email LIKE '%thunt%'))
Would like:
SELECT * FROM `users` WHERE ((user.username LIKE '%bjohnson%' OR
user.username LIKE '%thunt%') OR (user.email LIKE '%bjohnson%' OR
user.email LIKE '%thunt%'))
Has anyone found a way to do this?
On Jul 7, 7:25 am, eimantas <
enc.c...@gmail.com> wrote:
> Chris - thanks! Your solution should work for now (until it's,
> hopefully, implemented in SL 2.0)
>
> // E.
>
> On Jun 20, 12:23 am, Christian Mayer <
ch.ma...@gmail.com> wrote:
>
> > On Jun 19, 1:05 pm, Gokul Janga <
gok...@gmail.com> wrote:
>
> > > On Jun 19, 2:40 pm, eimantas <
enc.c...@gmail.com> wrote:
> > > > In verstion 1 there was a method 'any!' to define that search should
> > > > be made by union and not intersection. Is thereanysimilar method in
> > > > 2.0. i can't seem to find it anywhere
> > > The documentation does have an example -
>
> > > Useanyor all
>
> > > Every condition you’ve seen in this readme also has 2 related
> > > conditions that you can use. Example:
>
> > > User.username_like_any("bjohnson", "thunt") # will returnany
> > > users that have either of the strings in their username
> > > User.username_like_all("bjohnson", "thunt") # will returnany
> > > users that have all of the strings in their username
> > > User.username_like_any(["bjohnson", "thunt"]) # also accepts an
> > > array
>
> > I think eimantas meant Module: Searchlogic::Conditions::AnyOrAll#any!
> > which made the following possible:
> > | @search.conditions.any= true # can set this to "true" or "1" or