fix for search news,needs to applied to announcement,also need to fix some translation

This commit is contained in:
Matt 2012-09-24 18:10:48 +08:00
parent 029c84328d
commit 5f63af4e77
2 changed files with 7 additions and 6 deletions

View File

@ -19,16 +19,15 @@ class Panel::News::FrontEnd::NewsBulletinsController < OrbitWidgetController
if !params[:search_query].blank?
# 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?
binding.pry
@search = NewsBulletin.solr_search do
fulltext params[:search_query]
with(:frontend_search,true)
with(:available_lang, [I18n.locale.to_s])
#order_by(:average_rating)
with(:available_lang).any_of([I18n.locale.to_s])
#order_by(:postdate,:desc)
end
binding.pry
search_result = @search.results.collect{|result| result.id}.desc(:postdate)
@news_bulletins = NewsBulletin.all.available_for_lang(I18n.locale).can_display.any_in(_id:search_result).page( params[:page_main]).per(10)
search_result = @search.results.collect{|result| result.id}
@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
date_now = Time.now
if !params[:category_id].blank? && !params[:tag_id].blank?

View File

@ -112,7 +112,9 @@ class NewsBulletin
string :news_bulletin_category_id
time :postdate
end
# redis_search_index(:title_field => :s_title,
# :alias_field => :s_title_en,
# :score_field => :view_count,