I would setup your models differently, using Single-Table Inheritance
(STI).  (You can get more info on it by Googling "rails single table
inheritance".)  For your example, you'd have a table with columns like:

id, type, first_name, last_name, text1, text2, text3

Then, you'd have a model like:

class Text << ActiveRecord::Base
  acts_as_ferret(... declare all fields here )
end

You'd then subclass this with two other classes:

class EnglishText << Text
end

class DutchText << Text
end

Then, to search one or the other, use:

EnglishText.find_by_contents("english query")

DutchText.find_by_contents("dutch query")

That's a rough idea without exact code, but it should hopefully get you
started.

Thanks,

Doug

On 5/16/07, Alain Ravet <[EMAIL PROTECTED]> wrote:

Hi all,

Is there a way to have searches no use some indexed fields, when
processing a query?

context:
I have a model Foo that holds some information in two languages :
  - text1_nl, text2_nl, text3_nl
and
  - text1_en, text2_en, text3_en
Some other fields are common to both languages and indexed as well
   - first_name, last_name

Depending on the visitor language choice I need to exclude the first
three, or last three fields when query processing. Is this doable
relatively simply?
I guess I could use two indexes, but I'd like to keep using
acts_as_ferret if possible.


TIA.


Alain Ravet
--------
http://blog.ravet.com
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk

_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk

Reply via email to