railsでhyperestraierを使うacts_as_searchableを最近弄ってるのでメモ。 インストールとかは省略。こちらが参考になるかも。*1 ドキュメントはここに関数の一覧がある。 そして、検索方法なんかはhyperestraierのユーザーガイド参照する。 複雑な条件式とかできないのかーって色々調べた結果、結構複雑な条件式が使える事がわかったのでメモ。 基本形としてはmodelの定義に acts_as_searchable :attributes => { :title => nil, :blog => :blog_title }, :searchable_fields => [ :title, :body ] と書くとドキュメントにあるけど、基本的に全文検索の必要があるカラムをsearchable_fieldsに設定して、 併せて条件を書くカラムを:attribute