AutoCommit Sam Sep 5 15:03:11 CEST 2015
This commit is contained in:
@@ -157,7 +157,7 @@ class DocumentsController < ApplicationController
|
||||
@results = Document.search do
|
||||
fulltext params['query'] do
|
||||
fields :name, :text, :meeting
|
||||
highlight :text
|
||||
highlight :text,:name,:meeting
|
||||
end
|
||||
end
|
||||
@res=[]
|
||||
|
||||
@@ -5,15 +5,12 @@
|
||||
<ul>
|
||||
<% search_results.each_hit_with_result do |hit,result| %>
|
||||
<li> <%= link_to result.parent.title+": " + result.name, document_path(result) %>
|
||||
<div style="border:red 1px solid"><%= hit.highlights.to_yaml %></div>
|
||||
<div style="border:blue 1px solid"><%#= hit.to_yaml %></div>
|
||||
|
||||
<% hit.highlights(:name).each do |hlgt| %>
|
||||
<%= (hlgt.format{|word|"<b>#{word}</b>" } ).html_safe%>
|
||||
<% end %>
|
||||
<% %>
|
||||
<% hit.highlights(:text).each do |hlgt| %>
|
||||
<%= "text:" + (hlgt.format {|word| raw("<b>#{word}</b>") }).html_safe%>
|
||||
<% hit.highlights(:text).each do |hlgt| %>
|
||||
<%= ("<br>text: " + hlgt.format {|word| "<b>#{word}</b>" }).html_safe%>
|
||||
<% end %>
|
||||
<% hit.highlights(:meeting).each do |hlgt| %>
|
||||
<%= "text:" + (hlgt.format {|word| "*#{word}*" }).html_safe%>
|
||||
|
||||
Reference in New Issue
Block a user