Displaying 2 results from an estimated 2 matches for "highlighted_cont".
2005 Dec 14
4
Is it possible to highlight search keywords in results?
...arch results.  Just in case I''m not making sense,
here is an example of what I want:
query = ''contents:"testing|trucks"''
prepend = ''<strong>''
append = ''</strong>''
count = index.search_each(query) do |doc, score|
  highlighted_contents =
    index.highlight_for_query(doc, query, prepend, append)
  puts highlighted_contents
end
This would make all instances of "testing" and "trucks" appear in bold
for html formatted text.  Thoughts?
Thanks,
Carl
2007 Jun 07
3
:store => :yes doesn''t work in some cases
...ils DB when displaying the results. This is the code that I use to
show each result:
highlighted_name = result.highlight(params[:q], :field => :ferret_name,
:pre_tag => "<strong>", :post_tag => "</strong>", :excerpt_length =>
150, :num_excerpts => 1)
highlighted_content = result.highlight(params[:q], :field =>
:ferret_content, :pre_tag => "<strong>", :post_tag => "</strong>",
:excerpt_length => 150, :num_excerpts => 1)
Generally this all works fine. The problem happens when the ferret_name
of my model is a word th...