app/models/locomotive/content_entry.rb in locomotivecms-search-0.3.0 vs app/models/locomotive/content_entry.rb in locomotivecms-search-0.3.2
- old
+ new
@@ -5,11 +5,14 @@
search_by :options_for_search
def options_for_search
store = [:search_type, :label, :_slug, :site_id, :content_type_slug]
- content_type.entries_custom_fields.where(searchable: true).map(&:name) << { store: store }
+ content_type.entries_custom_fields.where(searchable: true).map(&:name) << {
+ store: store,
+ locale: proc { ::Mongoid::Fields::I18n.locale }
+ }
end
def search_type
self.content_type.name
end
@@ -27,6 +30,15 @@
"site_#{site_id}_#{content_type_slug}_#{id}"
else
"#{content_type_slug}_#{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)
+ end
+
end
\ No newline at end of file