We did end up finding a solution.
Tomasz Stachewicz, one of the Globalize authors pointed me to a gem
that adds accessors to the translated columns.
--
class Job < ActiveRecord::Base
translates :title, :description
globalize_accessors :locales => I18n.available_locales, :attributes
=> translated_attribute_names
searchable do
# sorting
string(:job_title) { title }
string(:description)
# keyword / fulltext searching
I18n.available_locales.each do |locale|
text(("text_" + locale.to_s).to_sym, :default_boost => 2)
{ eval("title_" + locale.to_s) }
text(("description_" + locale.to_s).to_sym, :stored => true)
{ eval("description_" + locale.to_s) }
end
end
end
--
On Nov 9, 9:33 am, Mark Brown <[email protected]> wrote:
> Hi,
>
> We're using globalize3 for model translations & sunspot / solr for searches.
>
> --
> class Job < ActiveRecord::Base
>
> translates :title, :description
>
> searchable do
> # sorting
> string(:job_title) { title }
> string(:description)
>
> # keyword / fulltext searching
> text(:title, :default_boost => 2)
> text(:description)
> end
>
> end
>
> --
> When saving a model, it's only indexing the last saved translation in the
> solr index though.
> Has anyone had any experience with indexing translated fields in a search
> db?
>
> Cheers,
>
> --
> Mark Brown
--
You received this message because you are subscribed to the Google Groups "Ruby
or Rails Oceania" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rails-oceania?hl=en.