Skip to content

Instantly share code, notes, and snippets.

@matteomanzo
Created April 18, 2018 08:11
Show Gist options
  • Save matteomanzo/ace9efae2075c116886b39b3d65c7ba3 to your computer and use it in GitHub Desktop.
Save matteomanzo/ace9efae2075c116886b39b3d65c7ba3 to your computer and use it in GitHub Desktop.
class UffiziIndex < Chewy::Index
class << self
def index_name(_suggest = nil)
"#{Rails.env}_uffizi_#{I18n.locale}"
end
end
define_type(
Artwork.includes(:museum),
delete_if: -> { translation_for(I18n.locale).nil? }
) do
field :title, value: -> { title }
field :author, value: -> { author }
field :formatted_text, value: -> { formatted_text }
field :abstract_text, value: -> { abstract_text }
field :formatted_renovation, value: -> { formatted_renovation }
field :location, value: -> { location }
field :technique, value: -> { technique }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment