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
|
def index
|
||||||
if !params[:search_query].blank?
|
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_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 = Redis::Search.query("Bulletin", params[:search_query], :conditions =>search_cond,:limit=>Bulletin.all.count)
|
||||||
search_result = search.collect{|t| t["id"]}
|
search_result = search.collect{|t| t["id"]}
|
||||||
|
|
|
@ -12,7 +12,7 @@ class Bulletin
|
||||||
|
|
||||||
# include NccuSearch
|
# 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 }
|
# is_impressionable :counter_cache => { :column_name => :view_count }
|
||||||
|
|
||||||
|
@ -67,8 +67,10 @@ class Bulletin
|
||||||
redis_search_index(:title_field => :s_title,
|
redis_search_index(:title_field => :s_title,
|
||||||
:alias_field =>:s_title_en ,
|
:alias_field =>:s_title_en ,
|
||||||
:score_field => :view_count,
|
: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 => [])
|
:ext_fields => [])
|
||||||
|
|
||||||
|
|
||||||
# def gen_title_for_search
|
# def gen_title_for_search
|
||||||
# # [s_title,s_title_en,s_text_en,s_text_zh_tw].join(' ')
|
# # [s_title,s_title_en,s_text_en,s_text_zh_tw].join(' ')
|
||||||
# end
|
# end
|
||||||
|
|
|
@ -10,7 +10,7 @@ class Panel::News::FrontEnd::NewsBulletinsController < OrbitWidgetController
|
||||||
|
|
||||||
def index
|
def index
|
||||||
if !params[:search_query].blank?
|
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_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 = Redis::Search.query("NewsBulletin", params[:search_query], :conditions =>search_cond,:limit=>NewsBulletin.all.count)
|
||||||
search_result = search.collect{|t| t["id"]}
|
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 }
|
# is_impressionable :counter_cache => { :column_name => :view_count }
|
||||||
|
|
||||||
|
@ -93,8 +93,9 @@ class NewsBulletin
|
||||||
redis_search_index(:title_field => :s_title,
|
redis_search_index(:title_field => :s_title,
|
||||||
:alias_field => :s_title_en,
|
:alias_field => :s_title_en,
|
||||||
:score_field => :view_count,
|
: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 =>[])
|
:ext_fields =>[])
|
||||||
|
|
||||||
# def gen_title_for_search
|
# def gen_title_for_search
|
||||||
# # [s_title,s_title_en,s_text_en,s_text_zh_tw].join(' ')
|
# # [s_title,s_title_en,s_text_en,s_text_zh_tw].join(' ')
|
||||||
# end
|
# end
|
||||||
|
|
Loading…
Reference in New Issue