From 9b10703283e08a389eec0930aaef3139fb001ce9 Mon Sep 17 00:00:00 2001 From: saurabhbhatia Date: Fri, 20 Dec 2013 22:41:33 +0800 Subject: [PATCH] Removed Sunspot Mongo from weblinks --- .../front_end/bulletins_controller.rb | 21 ++++++++++++------- .../bulletins/search_result.html.erb | 2 +- .../bulletins/bulletins_search_block.html.erb | 2 +- .../announcement/config/routes.rb | 2 ++ .../web_resource/app/models/web_link.rb | 1 - 5 files changed, 18 insertions(+), 10 deletions(-) diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb index 50128951..b7c9766b 100644 --- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb @@ -9,15 +9,22 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController end def search_result + debug if params[:search_query] == "" - @bulletins = get_bulletins_for_index + @bulletins = get_bulletins_for_index + else + @search = Bulletin.tire.search "#{params[:search_query]}" + search_result = @search.collect{|result| result.id} + + @bulletins = Bulletin.all.available_for_lang(I18n.locale).can_display.any_in(_id:search_result).page( params[:page_main]).per(@page_num) + end + end + + + def search + if params[:search_query] == "" + @bulletins = get_bulletins_for_index else - # @search = Bulletin.solr_search do - # fulltext params[:search_query] - # with(:frontend_search,true) - # with(:available_lang).any_of([I18n.locale.to_s]) - # end - # @bulletins = Bulletin.where(:category_id.in => params[:category_id]).and(:is_rejected=>false).and(:is_pending=>false) @search = Bulletin.tire.search "#{params[:search_query]}" search_result = @search.collect{|result| result.id} diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/search_result.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/search_result.html.erb index b7f27c00..3979362b 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/search_result.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/search_result.html.erb @@ -1,5 +1,5 @@ +

Test

<% # encoding: utf-8 %> - <%= flash_messages %>

<%= @page.title rescue nil %>

diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/bulletins_search_block.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/bulletins_search_block.html.erb index 538f340e..d2e61fd0 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/bulletins_search_block.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/bulletins_search_block.html.erb @@ -1,5 +1,5 @@

Search

-<%= form_tag panel_announcement_front_end_search_result_path, method: :get do %> +<%= form_tag panel_announcement_front_end_search_path, method: :get do %> <%= hidden_field_tag :category_id, params[:category_id] %> <%= hidden_field_tag :tag_id, params[:tag_id] %>

diff --git a/vendor/built_in_modules/announcement/config/routes.rb b/vendor/built_in_modules/announcement/config/routes.rb index 708996e7..75692e8b 100644 --- a/vendor/built_in_modules/announcement/config/routes.rb +++ b/vendor/built_in_modules/announcement/config/routes.rb @@ -28,6 +28,8 @@ Rails.application.routes.draw do namespace :front_end do match "index_by_unit" => "bulletins#index_bulletins_by_unit",:as => :index_bulletins_by_unit match "search_result" => "bulletins#search_result" + match "search" => "bulletins#search" + resources :bulletins # do # match "preview" => "bulletins#preview_content",:as => :get_preview_content # end diff --git a/vendor/built_in_modules/web_resource/app/models/web_link.rb b/vendor/built_in_modules/web_resource/app/models/web_link.rb index c2b1bba5..886f315c 100644 --- a/vendor/built_in_modules/web_resource/app/models/web_link.rb +++ b/vendor/built_in_modules/web_resource/app/models/web_link.rb @@ -3,7 +3,6 @@ class WebLink include Mongoid::Document include Mongoid::Timestamps include Mongoid::MultiParameterAttributes - include Sunspot::Mongoid2 include OrbitCategory::Categorizable include OrbitModel::LanguageRestrict