AutoCommit Sam Sep 5 15:03:11 CEST 2015

This commit is contained in:
Andreas Stephanides
2015-09-05 15:03:11 +02:00
parent c7d12e9a42
commit eccb090d5c
2 changed files with 3 additions and 6 deletions

View File

@@ -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=[]

View File

@@ -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%>
<%= ("<br>text: " + hlgt.format {|word| "<b>#{word}</b>" }).html_safe%>
<% end %>
<% hit.highlights(:meeting).each do |hlgt| %>
<%= "text:" + (hlgt.format {|word| "*#{word}*" }).html_safe%>