fix for search news,needs to applied to announcement,also need to fix some translation
This commit is contained in:
parent
029c84328d
commit
5f63af4e77
|
@ -19,16 +19,15 @@ class Panel::News::FrontEnd::NewsBulletinsController < OrbitWidgetController
|
||||||
if !params[:search_query].blank?
|
if !params[:search_query].blank?
|
||||||
# search_cond = {:is_checked=>true,:is_hidden=>false,:is_pending=>false,:is_pending=>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?
|
||||||
binding.pry
|
|
||||||
@search = NewsBulletin.solr_search do
|
@search = NewsBulletin.solr_search do
|
||||||
fulltext params[:search_query]
|
fulltext params[:search_query]
|
||||||
with(:frontend_search,true)
|
with(:frontend_search,true)
|
||||||
with(:available_lang, [I18n.locale.to_s])
|
with(:available_lang).any_of([I18n.locale.to_s])
|
||||||
#order_by(:average_rating)
|
#order_by(:postdate,:desc)
|
||||||
end
|
end
|
||||||
binding.pry
|
|
||||||
search_result = @search.results.collect{|result| result.id}.desc(:postdate)
|
search_result = @search.results.collect{|result| result.id}
|
||||||
@news_bulletins = NewsBulletin.all.available_for_lang(I18n.locale).can_display.any_in(_id:search_result).page( params[:page_main]).per(10)
|
@news_bulletins = NewsBulletin.all.available_for_lang(I18n.locale).can_display.any_in(_id:search_result).desc(:postdate).page( params[:page_main]).per(10)
|
||||||
else
|
else
|
||||||
date_now = Time.now
|
date_now = Time.now
|
||||||
if !params[:category_id].blank? && !params[:tag_id].blank?
|
if !params[:category_id].blank? && !params[:tag_id].blank?
|
||||||
|
|
|
@ -112,7 +112,9 @@ class NewsBulletin
|
||||||
|
|
||||||
|
|
||||||
string :news_bulletin_category_id
|
string :news_bulletin_category_id
|
||||||
|
time :postdate
|
||||||
end
|
end
|
||||||
|
|
||||||
# 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,
|
||||||
|
|
Reference in New Issue