I've read the other threads like this one
(http://www.ruby-forum.com/topic/78841) but I'm not sure what I'm doing
wrong.

Scenario: I need a full text search on financial institutions and to
constrain that list by state (=) or states (IN). My lenders model
includes a name and a state, among other fields. In my lenders model:

acts_as_ferret :fields => [:name]

Running this in script/console, I get a correct result (about 2100
hits):

Lender.find_by_contents("bank")

But when I start constraining with active record I get weird results.
This turns up one hit, which is correct:

Lender.find_by_contents("suntrust", {}, {:conditions=>["sta1 = 'DC'"]})

But this turns up zero hits, when it should be 11 hits according to my
SQL:

Lender.find_by_contents("bank", {}, {:conditions=>["sta1 = 'DC'"]})

Also, an IN search doesn't appear to constrain results at all. This
should turn up 16 rows but it turns up 31 (all the suntrusts, not
constrained by state):

Lender.find_by_contents("suntrust", {:conditions=>["sta1 IN ?",
"('AL','DC', 'FL')"]})

Any ideas?

-- 
Posted via http://www.ruby-forum.com/.
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk

Reply via email to