#32 ✓resolved
atmorell

input1 AND input3 AND (checkbox1 OR checkbox3)

Reported by atmorell | November 27th, 2008 @ 08:29 AM

Hey Ben,

I have constructed a search form and it works very well. There is one thing that is bugging me.

Example search form: firstname, (input) lastname, (input) email, (input) looking_for_friend (checkbox) looking_for_love (checkbox) looking for_wife (checkbox)

Is it possible to join the 3 looking for fields with OR instead of AND?

Best regards. Asbjørn Morell.

Comments and changes to this ticket

  • Ben Johnson

    Ben Johnson November 27th, 2008 @ 11:09 AM

    • State changed from “new” to “resolved”

    You can't cherry pick some fields to be joined with "and" and some with "or". What you can do is pass an array to some of the conditions and they will be joined with "or" that way. But since the 3 looking for fields are separate you would have to make the whole search joined with or.

    I get requests like this a lot. My intention with searchlogic was to never replace sql or advanced searches. There is nothing wrong with using scopes or sql in your instance. Chain some named_scopes together and then use searchlogic on the end of the chain.

    I am working on something to assist with this, but I thought I'd throw that out there.

  • atmorell

    atmorell November 27th, 2008 @ 11:50 AM

    Alright. I have no problem with using a bit of SQL combined with searchlogic :) Is there any chance that you could provide me with a small example of how I "chain" named scopes together and then use searchlogic. I am not lazy, but rather don't know how to accomplish something like that. (call me noob) Do you mean something like this: [railscast]( http://railscasts.com/episodes/1... / "railscast") ?

  • Pak24tv

    Pak24tv December 9th, 2020 @ 02:00 AM

    I am happy to find your distinguished way of writing the post. Now you make it easy for me to understand and implement the concept. Thank you for the post. tv one live apna tv live sleeping music

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Provides common named scopes and object based searching.

People watching this ticket

Pages