From 5f63af4e77e8d76521d9612efefdb8ef69e73767 Mon Sep 17 00:00:00 2001 From: Matt Date: Mon, 24 Sep 2012 18:10:48 +0800 Subject: [PATCH] fix for search news,needs to applied to announcement,also need to fix some translation --- .../panel/news/front_end/news_bulletins_controller.rb | 11 +++++------ .../built_in_modules/news/app/models/news_bulletin.rb | 2 ++ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/vendor/built_in_modules/news/app/controllers/panel/news/front_end/news_bulletins_controller.rb b/vendor/built_in_modules/news/app/controllers/panel/news/front_end/news_bulletins_controller.rb index 53df67e4..f6e7bba8 100644 --- a/vendor/built_in_modules/news/app/controllers/panel/news/front_end/news_bulletins_controller.rb +++ b/vendor/built_in_modules/news/app/controllers/panel/news/front_end/news_bulletins_controller.rb @@ -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? diff --git a/vendor/built_in_modules/news/app/models/news_bulletin.rb b/vendor/built_in_modules/news/app/models/news_bulletin.rb index 8e43fd83..34a07aab 100644 --- a/vendor/built_in_modules/news/app/models/news_bulletin.rb +++ b/vendor/built_in_modules/news/app/models/news_bulletin.rb @@ -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,