fix for redis search limit 10 items
This commit is contained in:
parent
4768da3c7a
commit
cc60ff8b4c
|
@ -23,7 +23,7 @@ Orbit::Application.configure do
|
||||||
# Only use best-standards-support built into browsers
|
# Only use best-standards-support built into browsers
|
||||||
config.action_dispatch.best_standards_support = :builtin
|
config.action_dispatch.best_standards_support = :builtin
|
||||||
|
|
||||||
config.cache_store = :mem_cache_store
|
# config.cache_store = :mem_cache_store
|
||||||
|
|
||||||
|
|
||||||
config.assets.debug = true
|
config.assets.debug = true
|
||||||
|
|
|
@ -298,4 +298,5 @@ en:
|
||||||
domains: Google Search Domains
|
domains: Google Search Domains
|
||||||
site_search: Site Search
|
site_search: Site Search
|
||||||
sitesearch: Google Site Search
|
sitesearch: Google Site Search
|
||||||
site_setting_help: Please Enter the search argument for Google search.
|
site_setting_help: Please Enter the search argument for Google search.
|
||||||
|
result_get: "Found %{item_num} items"
|
||||||
|
|
|
@ -436,6 +436,7 @@ zh_tw:
|
||||||
site_search: "全站搜尋"
|
site_search: "全站搜尋"
|
||||||
sitesearch: Google Site Search
|
sitesearch: Google Site Search
|
||||||
site_setting_help: 請輸入送交Google搜尋的參數
|
site_setting_help: 請輸入送交Google搜尋的參數
|
||||||
|
result_get: "共搜尋到%{item_num}筆資料"
|
||||||
activerecord:
|
activerecord:
|
||||||
errors:
|
errors:
|
||||||
template: # ~ 2.3.5 backward compatible
|
template: # ~ 2.3.5 backward compatible
|
||||||
|
|
|
@ -12,8 +12,9 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController
|
||||||
if !params[:search_query].blank?
|
if !params[:search_query].blank?
|
||||||
search_cond = {:is_checked=>true,:is_hidden=>false}
|
search_cond = {:is_checked=>true,:is_hidden=>false}
|
||||||
search_cond.merge!({:bulletin_category_id => "#{params[:category_id]}" }) if !params[:category_id].blank?
|
search_cond.merge!({:bulletin_category_id => "#{params[:category_id]}" }) if !params[:category_id].blank?
|
||||||
search = Redis::Search.query("Bulletin", params[:search_query], :conditions =>search_cond)
|
search = Redis::Search.query("Bulletin", params[:search_query], :conditions =>search_cond,:limit=>Bulletin.all.count)
|
||||||
search_result = search.collect{|t| t["id"]}
|
search_result = search.collect{|t| t["id"]}
|
||||||
|
|
||||||
@bulletins = Bulletin.all.can_display.any_in(_id:search_result).page( params[:page_main]).per(10)
|
@bulletins = Bulletin.all.can_display.any_in(_id:search_result).page( params[:page_main]).per(10)
|
||||||
else
|
else
|
||||||
date_now = Time.now
|
date_now = Time.now
|
||||||
|
|
|
@ -15,7 +15,11 @@
|
||||||
<th><%= t('announcement.bulletin.title') %></th>
|
<th><%= t('announcement.bulletin.title') %></th>
|
||||||
<th><%= t('announcement.bulletin.postdate') %></th>
|
<th><%= t('announcement.bulletin.postdate') %></th>
|
||||||
</tr>
|
</tr>
|
||||||
|
<% if @bulletins.blank? %>
|
||||||
|
<%=render :partial => 'shared/search_not_found' %>
|
||||||
|
<% else %>
|
||||||
|
<%= t("search.result_get",:item_num=>@bulletins.count) %>
|
||||||
|
<% end %>
|
||||||
<% @bulletins.each do |post| %>
|
<% @bulletins.each do |post| %>
|
||||||
<tr>
|
<tr>
|
||||||
<td><%= post.bulletin_category.i18n_variable[I18n.locale] rescue nil %></td>
|
<td><%= post.bulletin_category.i18n_variable[I18n.locale] rescue nil %></td>
|
||||||
|
|
|
@ -12,7 +12,7 @@ class Panel::News::FrontEnd::NewsBulletinsController < OrbitWidgetController
|
||||||
if !params[:search_query].blank?
|
if !params[:search_query].blank?
|
||||||
search_cond = {:is_checked=>true,:is_hidden=>false}
|
search_cond = {:is_checked=>true,:is_hidden=>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?
|
||||||
search = Redis::Search.query("NewsBulletin", params[:search_query], :conditions =>search_cond)
|
search = Redis::Search.query("NewsBulletin", params[:search_query], :conditions =>search_cond,:limit=>NewsBulletin.all.count)
|
||||||
search_result = search.collect{|t| t["id"]}
|
search_result = search.collect{|t| t["id"]}
|
||||||
@news_bulletins = NewsBulletin.all.can_display.any_in(_id:search_result).page( params[:page_main]).per(10)
|
@news_bulletins = NewsBulletin.all.can_display.any_in(_id:search_result).page( params[:page_main]).per(10)
|
||||||
else
|
else
|
||||||
|
|
|
@ -7,7 +7,11 @@
|
||||||
<% else %>
|
<% else %>
|
||||||
<h1 class="h1"><%= t('news.news') %></h1>
|
<h1 class="h1"><%= t('news.news') %></h1>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<% if @news_bulletins.blank? %>
|
||||||
|
<%=render :partial => 'shared/search_not_found' %>
|
||||||
|
<% else %>
|
||||||
|
<%= t("search.result_get",:item_num=>@news_bulletins.count) %>
|
||||||
|
<% end %>
|
||||||
<table class="table table-bordered">
|
<table class="table table-bordered">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -25,9 +29,6 @@
|
||||||
<td><%= display_date(post.postdate) %></td>
|
<td><%= display_date(post.postdate) %></td>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if @news_bulletins.blank? %>
|
|
||||||
<%=render :partial => 'shared/search_not_found' %>
|
|
||||||
<% end %>
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
Reference in New Issue