forked from bofh/fetsite
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
|
@results = Document.search do
|
||||||
fulltext params['query'] do
|
fulltext params['query'] do
|
||||||
fields :name, :text, :meeting
|
fields :name, :text, :meeting
|
||||||
highlight :text
|
highlight :text,:name,:meeting
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@res=[]
|
@res=[]
|
||||||
|
|||||||
@@ -5,15 +5,12 @@
|
|||||||
<ul>
|
<ul>
|
||||||
<% search_results.each_hit_with_result do |hit,result| %>
|
<% search_results.each_hit_with_result do |hit,result| %>
|
||||||
<li> <%= link_to result.parent.title+": " + result.name, document_path(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| %>
|
<% hit.highlights(:name).each do |hlgt| %>
|
||||||
<%= (hlgt.format{|word|"<b>#{word}</b>" } ).html_safe%>
|
<%= (hlgt.format{|word|"<b>#{word}</b>" } ).html_safe%>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% %>
|
<% %>
|
||||||
<% hit.highlights(:text).each do |hlgt| %>
|
<% 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 %>
|
<% end %>
|
||||||
<% hit.highlights(:meeting).each do |hlgt| %>
|
<% hit.highlights(:meeting).each do |hlgt| %>
|
||||||
<%= "text:" + (hlgt.format {|word| "*#{word}*" }).html_safe%>
|
<%= "text:" + (hlgt.format {|word| "*#{word}*" }).html_safe%>
|
||||||
|
|||||||
Reference in New Issue
Block a user