Hi, I''ve modified the latest acts_as_ferret code (version 0.3.0) to integrate with the Globalize (http://www.globalize-rails.org/globalize/) plugin. Essentially, I''ve added the ability to use a separate index per locale (It basically adds the language code as a suffix to the index and switches between indexes when the active locale changes). Since this introduces an optional external dependency and as I''ve had to touch the code up in a few files, I''m still trying to think of the best way to make this available to others. If others think this is worthwile, I''d be interested in adding this as something optional to acts_as_ferret. P.S. Currently, I''ve added the option like so: class Foo acts_as_ferret :single_index => true, :store_class_name => true, :localized => true, #=> this activates the option. :fields => {...} end Regards, Saimon (http://saimonmoore.net) -- Posted via http://www.ruby-forum.com/.
Did you consider using a single index, but add a locale field to every record to allow easy filtering by selected locale? If so, what are the advantages to separate indexes? Erik On Jan 16, 2007, at 7:03 PM, Saimon Moore wrote:> Hi, > > I''ve modified the latest acts_as_ferret code (version 0.3.0) to > integrate with the Globalize (http://www.globalize-rails.org/ > globalize/) > plugin. > > Essentially, I''ve added the ability to use a separate index per locale > (It basically adds the language code as a suffix to the index and > switches between indexes when the active locale changes). > > Since this introduces an optional external dependency and as I''ve > had to > touch the code up in a few files, I''m still trying to think of the > best > way to make this available to others. > > If others think this is worthwile, I''d be interested in adding this as > something optional to acts_as_ferret. > > P.S. Currently, I''ve added the option like so: > > class Foo > acts_as_ferret :single_index => true, > :store_class_name => true, > :localized => true, #=> this activates the > option. > :fields => {...} > end > > Regards, > > Saimon > > (http://saimonmoore.net) > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Ferret-talk mailing list > Ferret-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/ferret-talk
Hi Erik, I did consider this but I think having separate indexes per locale is slightly cleaner and seemed a more logical approach to me. A rebuild can be ordered for one locale without having to affect the other indices. The overhead of switching indices when the locale changes is minimal, and no filtering is required so it should be slightly faster as well overall. Also each individual index is only as large as the data available in that locale. In my particular case I''m using a single index and searching through multiple models at the same time. Since my application uses 4 locales, I have 4 indices, one shared index per locale. I think perhaps that if one-index-per-model schema is used then storing the locale within each record is perhaps a better option. Another advantage I see to this is that if this becomes a part of acts_as_ferret then most users will have to do very little to have localised ferret searching. This works well for my use-case but I''d add both possibilities to the acts_as_ferret documentation. Regards, Saimon Erik Hatcher wrote:> Did you consider using a single index, but add a locale field to > every record to allow easy filtering by selected locale? If so, what > are the advantages to separate indexes? > > Erik-- Posted via http://www.ruby-forum.com/.
Hi! On Wed, Jan 17, 2007 at 01:03:30AM +0100, Saimon Moore wrote:> Hi, > > I''ve modified the latest acts_as_ferret code (version 0.3.0) to > integrate with the Globalize (http://www.globalize-rails.org/globalize/) > plugin. > > Essentially, I''ve added the ability to use a separate index per locale > (It basically adds the language code as a suffix to the index and > switches between indexes when the active locale changes).sounds cool :-)> Since this introduces an optional external dependency and as I''ve had to > touch the code up in a few files, I''m still trying to think of the best > way to make this available to others. > > If others think this is worthwile, I''d be interested in adding this as > something optional to acts_as_ferret.I''d really like to have a look at it. Do you think you could provide a patch against the current acts_as_ferret trunk ? cheers, Jens -- webit! Gesellschaft f?r neue Medien mbH www.webit.de Dipl.-Wirtschaftsingenieur Jens Kr?mer kraemer at webit.de Schnorrstra?e 76 Tel +49 351 46766 0 D-01069 Dresden Fax +49 351 46766 66
Hi Jens, Yep no probs. I''ll send it to you as soon as I can as I''ll have to modify accordingly for trunk. Regards, Saimon Jens Kraemer wrote:> Hi! > > On Wed, Jan 17, 2007 at 01:03:30AM +0100, Saimon Moore wrote: >> Hi, >> >> I''ve modified the latest acts_as_ferret code (version 0.3.0) to >> integrate with the Globalize (http://www.globalize-rails.org/globalize/) >> plugin. >> >> Essentially, I''ve added the ability to use a separate index per locale >> (It basically adds the language code as a suffix to the index and >> switches between indexes when the active locale changes). > > sounds cool :-) > >> Since this introduces an optional external dependency and as I''ve had to >> touch the code up in a few files, I''m still trying to think of the best >> way to make this available to others. >> >> If others think this is worthwile, I''d be interested in adding this as >> something optional to acts_as_ferret. > > I''d really like to have a look at it. Do you think you could provide a > patch against the current acts_as_ferret trunk ? > > > cheers, > Jens > > > -- > webit! Gesellschaft f?r neue Medien mbH www.webit.de > Dipl.-Wirtschaftsingenieur Jens Kr?mer kraemer at webit.de > Schnorrstra?e 76 Tel +49 351 46766 0 > D-01069 Dresden Fax +49 351 46766 66-- Posted via http://www.ruby-forum.com/.
Hi, Just for the record: i would be quite interested in such a plugin - i developed my own (quite poor) hack for it myself (which is not in production yet), but your approach seems to be much better. If there is any help or testing needed, feel free to contact me. Greetings Florian Saimon Moore wrote:> Hi, > > I''ve modified the latest acts_as_ferret code (version 0.3.0) to > integrate with the Globalize (http://www.globalize-rails.org/globalize/) > plugin. > > Essentially, I''ve added the ability to use a separate index per locale > (It basically adds the language code as a suffix to the index and > switches between indexes when the active locale changes). > > Since this introduces an optional external dependency and as I''ve had to > touch the code up in a few files, I''m still trying to think of the best > way to make this available to others. > > If others think this is worthwile, I''d be interested in adding this as > something optional to acts_as_ferret. > > P.S. Currently, I''ve added the option like so: > > class Foo > acts_as_ferret :single_index => true, > :store_class_name => true, > :localized => true, #=> this activates the > option. > :fields => {...} > end > > Regards, > > Saimon > > (http://saimonmoore.net) >