On 7/21/06, Vanesa Mirzaee <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I wonder if it is possible to perform the "find_by_contents" on a subset
> of fields indexed in acts_as_ferret.If so, how?
>
> In my code I have:
>
> acts_as_ferret (:fields => ['title', 'focus', 'purpose'])
>
> However, I like to have two search options one on all fields and one
> only on the title.
>
> Any help is most appreciated.
>
> Thanks,

Hi Venesa,

You can search a specific field by prepending the query with the field
name. For example %{title:"Lord of the Rings" purpose:"enjoyment"}.
Or, if you don't want the users typing in field names, you could
modify the query_string to search only the title field like this;

    query_string = "title:(#{query_string})"

Hope that helps,
Dave

PS : (Jens, please correct me if this won't work with acts_as_ferret)
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk

Reply via email to