Update Search Engine
This commit is contained in:
parent
e8b273ee74
commit
2d34d9edcf
|
@ -1,5 +1,5 @@
|
|||
class SiteSearchController < ApplicationController
|
||||
|
||||
include ActionView::Helpers::TextHelper
|
||||
def search
|
||||
startTime = Time.now
|
||||
if params[:keywords].present?
|
||||
|
@ -76,14 +76,7 @@ class SiteSearchController < ApplicationController
|
|||
next
|
||||
end
|
||||
|
||||
index = res[:content].index '<b>'
|
||||
unless index.nil?
|
||||
index = index>50 ? index-50 : 0
|
||||
deadline = 150
|
||||
res[:content] = res[:content][index, deadline]
|
||||
else
|
||||
res[:content] = res[:content][0, 100]
|
||||
end
|
||||
res[:content] = truncate(res[:content], length: 150)
|
||||
end
|
||||
|
||||
result = result.sort_by { |k| k[:matches] }.reverse rescue []
|
||||
|
|
Loading…
Reference in New Issue