On Fri, Dec 01, 2006 at 06:46:44AM +0100, koloa wrote:
> maybe something like
> 
> find_by_contents(searchstring +" "+ state:selectedstate)

make that

find_by_contents("#{searchstring} +state:#{selectedstate}")

and it should work. if you store the state acronym in the state field,
it might be a good idea to give :index => :untokenized as an option for
this field in your call to acts_as_ferret:

acts_as_ferret :fields => { 
                  :content => {}, 
                  :state   => { :index => :untokenized },
                  ... any other fields you want to have indexed
                }

this works great for i.e. having a select box to let the user select a
state he wants to search in. Generally, not tokenizing a field is a good 
thing whenever you expect exact matches on a field, or want to sort your
results using this field. You can have a look at the Ferret API docs 
(class FieldInfo) for more options and their explanations.


cheers,
Jens

-- 
webit! Gesellschaft für neue Medien mbH          www.webit.de
Dipl.-Wirtschaftsingenieur Jens Krämer       [EMAIL PROTECTED]
Schnorrstraße 76                         Tel +49 351 46766  0
D-01069 Dresden                          Fax +49 351 46766 66
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk

Reply via email to