Advice on Search Design

I've been having problems submitting a question to this forum so sorry
in advance if this is a repeat.

I am not looking for code examples, just a pointer in the right
direction as far as design. I am trying to do a search based on
information form 4 select boxes. None of the select boxes are mandatory
so there could be a lot of possible combinations.

search for field one, field one and two, field two and three, etc.

I know an if else statement for all the possible combinations would not
be the right way to go. Should I use Ferret or Sphinx to do a search
like this or is there a better way.

Thanks in advance.

Google for “searchlogic”. It’s a rails plugin that makes stuff like this very easy to do.


I researched searchlogic prior to posting and unless I am missing
something I don't see how it would get around something like this:

if a,b & c but not d
elsif a & b but not c & d
elsif a and not b,c & d

I did see something construct a mysql query, based on something like:

query = ""
if a then query << ""
if b then query << ""
if c then query << ""
if d then query << ""

but they also stated this was a bad idea...

Am I missing something within the searchlogic doc?