Module: FulltextSearchable::ActiveRecord::Behaviors

Extended by:
ActiveSupport::Concern
Defined in:
lib/fulltext_searchable/active_record.rb

Overview

各モデルにincludeされるモジュール

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#fulltext_keywordsObject

レコードの内容を全文検索インデックス用に変換



119
120
121
122
123
124
125
126
127
128
129
# File 'lib/fulltext_searchable/active_record.rb', line 119

def fulltext_keywords
  # 論理削除されていたら空に
  return '' if self.respond_to?(:deleted?) && self.deleted?
  [
    FulltextSearchable.to_model_keyword(self.class.name),
    FulltextSearchable.to_item_keyword(self),
  ].
  tap{|a| a.push(fulltext_keyword_proc.call) if fulltext_keyword_proc }.
    concat(collect_fulltext_keywords(self, fulltext_columns)).
    flatten.join(' ')
end