app/models/locomotive/content_entry.rb in locomotivecms-search-0.3.5 vs app/models/locomotive/content_entry.rb in locomotivecms-search-0.3.6

- old
+ new

@@ -1,11 +1,11 @@ require_dependency Locomotive::Engine.root.join('app', 'models', 'locomotive', 'content_entry').to_s Locomotive::ContentEntry.class_eval do include Locomotive::Search::Extension - search_by :options_for_search + search_by :options_for_search, if: :is_searchable? 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, @@ -33,10 +33,14 @@ else "#{content_type_slug}_#{locale}_#{id}" end end + def is_searchable? + self.content_type.searchable? + end + alias_method :to_indexable_without_verbosity, :to_indexable def to_indexable(depth = 0) return self._label if depth > 0 @@ -45,6 +49,6 @@ 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 +end