make sure no pending news or announcement will be searched out
This commit is contained in:
parent
afa4b7dcb3
commit
effad63c92
|
@ -10,7 +10,7 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController
|
|||
|
||||
def index
|
||||
if !params[:search_query].blank?
|
||||
search_cond = {:is_checked=>true,:is_hidden=>false}
|
||||
search_cond = {:is_checked=>true,:is_hidden=>false,:is_pending => false}
|
||||
search_cond.merge!({:bulletin_category_id => "#{params[:category_id]}" }) if !params[:category_id].blank?
|
||||
search = Redis::Search.query("Bulletin", params[:search_query], :conditions =>search_cond,:limit=>Bulletin.all.count)
|
||||
search_result = search.collect{|t| t["id"]}
|
||||
|
|
|
@ -12,7 +12,7 @@ class Bulletin
|
|||
|
||||
# include NccuSearch
|
||||
|
||||
scope :searchable,where(:is_checked=>true,:is_hidden=>false,:is_pending=>false)
|
||||
#scope :searchable,where(:is_checked=>true,:is_hidden=>false,:is_pending=>false)
|
||||
|
||||
# is_impressionable :counter_cache => { :column_name => :view_count }
|
||||
|
||||
|
@ -67,8 +67,10 @@ class Bulletin
|
|||
redis_search_index(:title_field => :s_title,
|
||||
:alias_field =>:s_title_en ,
|
||||
:score_field => :view_count,
|
||||
:condition_fields => [:is_checked,:is_hidden,:bulletin_category_id],
|
||||
:condition_fields => [:is_checked,:is_hidden,:bulletin_category_id,:is_pending],
|
||||
:ext_fields => [])
|
||||
|
||||
|
||||
# def gen_title_for_search
|
||||
# # [s_title,s_title_en,s_text_en,s_text_zh_tw].join(' ')
|
||||
# end
|
||||
|
|
|
@ -10,7 +10,7 @@ class Panel::News::FrontEnd::NewsBulletinsController < OrbitWidgetController
|
|||
|
||||
def index
|
||||
if !params[:search_query].blank?
|
||||
search_cond = {:is_checked=>true,:is_hidden=>false}
|
||||
search_cond = {:is_checked=>true,:is_hidden=>false,:is_pending=>false,:is_pending=>false}
|
||||
search_cond.merge!({:news_bulletin_category_id => "#{params[:category_id]}" }) if !params[:category_id].blank?
|
||||
search = Redis::Search.query("NewsBulletin", params[:search_query], :conditions =>search_cond,:limit=>NewsBulletin.all.count)
|
||||
search_result = search.collect{|t| t["id"]}
|
||||
|
|
|
@ -15,7 +15,7 @@ class NewsBulletin
|
|||
|
||||
|
||||
|
||||
scope :searchable,where(:is_checked=>true,:is_hidden=>false,:is_pending=>false)
|
||||
#scope :searchable,where(:is_checked=>true,:is_hidden=>false,:is_pending=>false)
|
||||
|
||||
# is_impressionable :counter_cache => { :column_name => :view_count }
|
||||
|
||||
|
@ -93,8 +93,9 @@ class NewsBulletin
|
|||
redis_search_index(:title_field => :s_title,
|
||||
:alias_field => :s_title_en,
|
||||
:score_field => :view_count,
|
||||
:condition_fields => [:is_checked,:is_hidden,:news_bulletin_category_id],
|
||||
:condition_fields => [:is_checked,:is_hidden,:news_bulletin_category_id,:is_pending],
|
||||
:ext_fields =>[])
|
||||
|
||||
# def gen_title_for_search
|
||||
# # [s_title,s_title_en,s_text_en,s_text_zh_tw].join(' ')
|
||||
# end
|
||||
|
|
Reference in New Issue