title: Search around the word
body: <p>I would like to create a search function that would display the search word in bold and the text is centered (surrounding?) around the word.</p>
  
  <p>Example:
  I have this text : </p>
  
  <blockquote>
    <p>Purus! Porta parturient risus a hac dapibus nec, hac tortor habitasse
    adipiscing, nec facilisis aenean, facilisis dignissim ridiculus,
    integer est cum? Porttitor nisi nec. Platea, tortor egestas sagittis
    ut nisi phasellus enim parturient adipiscing lorem odio, montes
    dictumst, mus rhoncus a placerat. Lorem proin, cum mattis aenean nec.
    Augue et lorem ac augue cursus sit adipiscing! Augue sociis mattis
    amet! Natoque lorem pid. In est tincidunt, vut, arcu, duis? Cum cras
    sociis tristique sociis odio. Placerat ut rhoncus dictumst porta magna
    enim enim sed et tincidunt arcu duis integer elementum, hac dignissim.
    Montes duis ut. Auctor risus pulvinar cras, platea tincidunt in ut
    adipiscing, augue. Quis sed vel! Dapibus placerat, ac ridiculus
    integer urna porttitor magnis platea cursus, mid in.</p>
  </blockquote>
  
  <p>In this text a search the word <strong>adipiscing!</strong> </p>
  
  <p>And i want for result not all text but just : </p>
  
  <blockquote>
    <p>...ac augue cursus sit <strong>adipiscing!</strong> Augue sociis mattis amet!...</p>
  </blockquote>
  
  <p>For the moment, i write that </p>
  
  <pre><code> &lt;%= highlight(truncate(sanitize(sound.document.html_safe), :length =&gt; 3000), @soundsstring) %&gt;
  </code></pre>
  
  <p>And in my controller : </p>
  
  <pre><code>@sounds = Sound.where(:user_id =&gt; current_user.id).search(params[:search]).order('created_at DESC').order(sort_column + " " + sort_direction).page(params[:page]).per(15)
  respond_to do |format|
    format.html # index.html.erb
    format.json { render json: @sounds }
    @soundsstring = params[:search]
  </code></pre>
  
  <p>And the word search appear in bold. But the research was centered in the word. If you can help me.</p>
  
  <p>I hope I was clear</p>
  
  <p>Thank.</p>