This is my first question here, after many months of concealment and absorption. Therefore, I hope I do it right.
I am trying to get the multi-user pg_search function working in my Rails 3.2.3 application after learning the pg_search_scope function from this Railscast.I believe that the pg_search documentation assumes that the reader has better knowledge of Rails than I have. I simply could not make the transition from the resources that I found to get a working application using multisearch. Any help is appreciated. Here is my setup:
configurations / initializers / pg_search.rb
PgSearch.multisearch_options = { :using => { :tsearch => { :dictionary => "english" }, :trigram => {} }, :ignoring => :accents }
View Search Form
<%= form_tag articles_path, method: :get do %> <%= text_field_tag :query, params[:query], :class => "search-box" %> <%= submit_tag "Search This Site", name: nil, :class => "btn btn-search" %> <% end %>
article.rb
include PgSearch multisearchable :against => [:title, :content] def self.search(query) if query.present? search(query) else scoped end end
articles_controller.rb
def index @articles = PgSearch.multisearch(params[:query]) respond_to do |format| format.html
I do not get search results when searching for known terms. What am I doing wrong?
source share