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
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?
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 H. 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?
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 [email protected]
Schnorrstraße 76 Tel +49 351 46766 0
D-01069 Dresden Fax +49 351 46766 66
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.
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 [email protected]
Schnorrstra�e 76 Tel +49 351 46766 0
D-01069 Dresden Fax +49 351 46766 66
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.