Skip to content

Instantly share code, notes, and snippets.

@markbrown4
Created November 9, 2011 01:37
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save markbrown4/1350036 to your computer and use it in GitHub Desktop.
Save markbrown4/1350036 to your computer and use it in GitHub Desktop.
solr translated fields from Globalize3
class Job < ActiveRecord::Base
translates :title
globalize_accessors :locales => I18n.available_locales, :attributes => translated_attribute_names
searchable do
I18n.available_locales.each do |locale|
sym = ("title_" + locale.to_s).to_sym
# sorting
string(sym) { eval(sym) }
# keyword / fulltext searching
text(sym, :default_boost => 2) { eval(sym) }
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment