AutoCommit Fre Sep 4 14:03:04 CEST 2015

This commit is contained in:
Andreas Stephanides
2015-09-04 14:03:04 +02:00
parent f7ad93c398
commit c7d12e9a42
2 changed files with 10 additions and 5 deletions

View File

@@ -102,7 +102,7 @@ class Document < ActiveRecord::Base
end
text :name, :boost=>4.0, :stored=> true
text :meeting, stored: true do |d|
(d.parent_type == "Meeting")? d.try(:parent).try(:text).to_s : ""
(d.parent.is_a?(Meeting))? d.try(:parent).try(:text).to_s : ""
end
end
def maketoc

View File

@@ -1,17 +1,22 @@
<% unless search_results.nil? %>
<%= search_results %>
<%#= search_results %>
<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| %>
<%= raw(hlgt.format{|word|"<b>#{word}</b>" } ) %>
<%= (hlgt.format{|word|"<b>#{word}</b>" } ).html_safe%>
<% end %>
<% %>
<% hit.highlights(:text).each do |hlgt| %>
<%= "text:" + raw(hlgt.format {|word| raw("<b>#{word}</b>") })%>
<%= "text:" + (hlgt.format {|word| raw("<b>#{word}</b>") }).html_safe%>
<% end %>
<% hit.highlights(:meeting).each do |hlgt| %>
<%= "text:" + raw(hlgt.format {|word| "*#{word}*" })%>
<%= "text:" + (hlgt.format {|word| "*#{word}*" }).html_safe%>
<% end %>
</li>