Remove elasticsearch
This commit is contained in:
parent
6ae35f3b94
commit
829fc54a1d
|
@ -12,8 +12,13 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController
|
|||
if params[:search_query] == ""
|
||||
@bulletins = get_bulletins_for_index
|
||||
else
|
||||
@search = Bulletin.tire.search "#{params[:search_query]}"
|
||||
search_result = @search.collect{|result| result.id}
|
||||
key_string = params[:search_query]
|
||||
keywords = key_string.split(/\s+(?=(?:[^"]*"[^"]*")*[^"]*$)/)
|
||||
regex = Regexp.union(keywords.map{|word| Regexp.new(".*"+word+".*", "i")})
|
||||
|
||||
query = ["title","subtitle","text"].map{|f| {f.to_sym => regex} }
|
||||
res = Bulletin.any_of(query)
|
||||
search_result = res.collect{|result| result.id}
|
||||
|
||||
@bulletins = Bulletin.all.available_for_lang(I18n.locale).can_display.any_in(_id:search_result).page( params[:page_main]).per(@page_num)
|
||||
end
|
||||
|
|
|
@ -13,8 +13,8 @@ class Bulletin
|
|||
include OrbitModel::TimeFrame
|
||||
include OrbitTag::Taggable
|
||||
|
||||
include Tire::Model::Search
|
||||
include Tire::Model::Callbacks
|
||||
# include Tire::Model::Search
|
||||
# include Tire::Model::Callbacks
|
||||
|
||||
is_impressionable :counter_cache => { :column_name => :view_count }
|
||||
|
||||
|
@ -55,9 +55,9 @@ class Bulletin
|
|||
|
||||
validates :title, :at_least_one => true
|
||||
|
||||
def to_indexed_json
|
||||
self.to_json
|
||||
end
|
||||
# def to_indexed_json
|
||||
# self.to_json
|
||||
# end
|
||||
|
||||
# search_in :title, :subtitle, :text
|
||||
|
||||
|
|
Loading…
Reference in New Issue