fix redis search limit for 10 items
This commit is contained in:
parent
4768da3c7a
commit
fb1f08327d
|
@ -298,4 +298,5 @@ en:
|
|||
domains: Google Search Domains
|
||||
site_search: 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: "全站搜尋"
|
||||
sitesearch: Google Site Search
|
||||
site_setting_help: 請輸入送交Google搜尋的參數
|
||||
result_get: "共搜尋到%{item_num}筆資料"
|
||||
activerecord:
|
||||
errors:
|
||||
template: # ~ 2.3.5 backward compatible
|
||||
|
|
|
@ -12,8 +12,9 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController
|
|||
if !params[:search_query].blank?
|
||||
search_cond = {:is_checked=>true,:is_hidden=>false}
|
||||
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"]}
|
||||
|
||||
@bulletins = Bulletin.all.can_display.any_in(_id:search_result).page( params[:page_main]).per(10)
|
||||
else
|
||||
date_now = Time.now
|
||||
|
|
|
@ -15,7 +15,11 @@
|
|||
<th><%= t('announcement.bulletin.title') %></th>
|
||||
<th><%= t('announcement.bulletin.postdate') %></th>
|
||||
</tr>
|
||||
|
||||
<% if @bulletins.blank? %>
|
||||
<%=render :partial => 'shared/search_not_found' %>
|
||||
<% else %>
|
||||
<%= t("search.result_get",:item_num=>@bulletins.count) %>
|
||||
<% end %>
|
||||
<% @bulletins.each do |post| %>
|
||||
<tr>
|
||||
<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?
|
||||
search_cond = {:is_checked=>true,:is_hidden=>false}
|
||||
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"]}
|
||||
@news_bulletins = NewsBulletin.all.can_display.any_in(_id:search_result).page( params[:page_main]).per(10)
|
||||
else
|
||||
|
|
|
@ -7,7 +7,11 @@
|
|||
<% else %>
|
||||
<h1 class="h1"><%= t('news.news') %></h1>
|
||||
<% 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">
|
||||
<tbody>
|
||||
<tr>
|
||||
|
@ -25,9 +29,6 @@
|
|||
<td><%= display_date(post.postdate) %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if @news_bulletins.blank? %>
|
||||
<%=render :partial => 'shared/search_not_found' %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
|
Reference in New Issue