Removed Sunspot Mongo from weblinks

This commit is contained in:
saurabhbhatia 2013-12-20 22:41:33 +08:00
parent c36d730bd3
commit 9b10703283
5 changed files with 18 additions and 10 deletions

View File

@ -9,15 +9,22 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController
end end
def search_result def search_result
debug
if params[:search_query] == "" 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 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 = Bulletin.tire.search "#{params[:search_query]}"
search_result = @search.collect{|result| result.id} search_result = @search.collect{|result| result.id}

View File

@ -1,5 +1,5 @@
<p>Test</p>
<% # encoding: utf-8 %> <% # encoding: utf-8 %>
<%= flash_messages %> <%= flash_messages %>
<h1 class="h1"><%= @page.title rescue nil %></h1> <h1 class="h1"><%= @page.title rescue nil %></h1>

View File

@ -1,5 +1,5 @@
<p>Search</p> <p>Search</p>
<%= 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 :category_id, params[:category_id] %>
<%= hidden_field_tag :tag_id, params[:tag_id] %> <%= hidden_field_tag :tag_id, params[:tag_id] %>
<p> <p>

View File

@ -28,6 +28,8 @@ Rails.application.routes.draw do
namespace :front_end do namespace :front_end do
match "index_by_unit" => "bulletins#index_bulletins_by_unit",:as => :index_bulletins_by_unit match "index_by_unit" => "bulletins#index_bulletins_by_unit",:as => :index_bulletins_by_unit
match "search_result" => "bulletins#search_result" match "search_result" => "bulletins#search_result"
match "search" => "bulletins#search"
resources :bulletins # do resources :bulletins # do
# match "preview" => "bulletins#preview_content",:as => :get_preview_content # match "preview" => "bulletins#preview_content",:as => :get_preview_content
# end # end

View File

@ -3,7 +3,6 @@ class WebLink
include Mongoid::Document include Mongoid::Document
include Mongoid::Timestamps include Mongoid::Timestamps
include Mongoid::MultiParameterAttributes include Mongoid::MultiParameterAttributes
include Sunspot::Mongoid2
include OrbitCategory::Categorizable include OrbitCategory::Categorizable
include OrbitModel::LanguageRestrict include OrbitModel::LanguageRestrict