app/models/locomotive/content_entry.rb in locomotivecms-search-0.3.4 vs app/models/locomotive/content_entry.rb in locomotivecms-search-0.3.5
- old
+ new
@@ -24,21 +24,27 @@
def content_type_slug
self.content_type.slug
end
def indexable_id
+ locale = ::Mongoid::Fields::I18n.locale
+
if respond_to?(:site_id)
- "site_#{site_id}_#{content_type_slug}_#{id}"
+ "site_#{site_id}_#{content_type_slug}_#{locale}_#{id}"
else
- "#{content_type_slug}_#{id}"
+ "#{content_type_slug}_#{locale}_#{id}"
end
end
alias_method :to_indexable_without_verbosity, :to_indexable
def to_indexable(depth = 0)
return self._label if depth > 0
- to_indexable_without_verbosity(depth)
+ begin
+ to_indexable_without_verbosity(depth)
+ rescue Exception => e
+ Rails.logger.error "Unable to index #{content_type_slug}/#{self._label}[#{self._id}], error = #{e.message}"
+ end
end
end
\ No newline at end of file