title: Rails 4 search function
body: <p>I have this simple search function: </p>
  
  <pre><code>class SearchController &lt; ApplicationController
   def index
      if params[:search].blank?
        redirect_to root_path
      else
        @results = Post.search(params[:search])
      end
    end
  end
  </code></pre>
  
  <p>I want to implement the following functionalities but I am struggling to code:</p>
  
  <p>1.How to record each of the input search terms and see whether which search terms are the most searched ones. I thought of using "first_or_create" method...</p>
  
  <p>2.Give I have this title: "Peter Paul Mary", how do I split them and link_to each terms to search the search function</p>
  
  <p>Please advise.</p>