title: Rails 3 Searching HTML Content with Sunspot
body: <p>I'm storing some HTML content in my database and I would like to be able to perform a search using Sunspot while omitting HTML from the hit output and if possible the search itself. </p>
  
  <p>My model:</p>
  
  <pre><code>class Article &lt; ActiveRecord::Base
  
    attr_accessible :caption
    searchable do
      text :content, :stored =&gt; true
    end
  
  end
  </code></pre>
  
  <p>Search action:</p>
  
  <pre><code>def find    
    @search = Article.search do
      fulltext params[:search] do
        highlight :name
      end
    end      
  end
  </code></pre>
  
  <p>Template:</p>
  
  <pre><code>- @search.each_hit_with_result do |hit, article|
    - unless hit.highlight(:content).nil?
        %p= hit.highlight(:content).format { |word| "&lt;span class=\"highlight\"&gt;#{strip_tags(word)}&lt;/span&gt;"}.html_safe
  </code></pre>
  
  <p>Some sample content that is being search might be something like:</p>
  
  <pre><code>&lt;h1&gt;Hello world&lt;/h1&gt;
  &lt;p&gt; Search for me me!&lt;/p&gt;
  &lt;a href="#"&gt;Link&lt;/a&gt;
  </code></pre>
  
  <p>Notice that I'm marking the output as html_safe? This is because I would like the wrap the search text that gets hit with a highlight span, however besides that everything else I want to be stripped completely from the returned text that gets hit. Is this even possible?</p>