Commit 3fc7f548450ea909936d389c0c5d9b0a08483e53
1 parent
42d8315d
Exists in
staging
and in
42 other branches
Fixes and tweaks for searching
Showing
2 changed files
with
7 additions
and
4 deletions
Show diff stats
app/controllers/public/search_controller.rb
| ... | ... | @@ -29,12 +29,11 @@ class SearchController < PublicController |
| 29 | 29 | end |
| 30 | 30 | |
| 31 | 31 | def articles |
| 32 | - @filter = params[:filter] ? filter : nil | |
| 33 | - @filter_title = params[:filter] ? filter_description(@asset, @filter) : nil | |
| 34 | 32 | if !@empty_query |
| 35 | 33 | full_text_search ['public:true'] |
| 36 | - elsif params[:filter] | |
| 34 | + else | |
| 37 | 35 | @results[@asset] = @environment.articles.public.send(@filter).paginate(paginate_options) |
| 36 | + facets = {} | |
| 38 | 37 | end |
| 39 | 38 | end |
| 40 | 39 | |
| ... | ... | @@ -54,6 +53,9 @@ class SearchController < PublicController |
| 54 | 53 | def products |
| 55 | 54 | if !@empty_query |
| 56 | 55 | full_text_search ['public:true'] |
| 56 | + else | |
| 57 | + @results[@asset] = @environment.products.send(@filter).paginate(paginate_options) | |
| 58 | + @facets = {} | |
| 57 | 59 | end |
| 58 | 60 | end |
| 59 | 61 | |
| ... | ... | @@ -238,6 +240,7 @@ class SearchController < PublicController |
| 238 | 240 | 'communities_more_recent' => _('More recent communities from network'), |
| 239 | 241 | 'communities_more_active' => _('More active communities from network'), |
| 240 | 242 | 'communities_more_popular' => _('More popular communities from network'), |
| 243 | + 'products_more_recent' => _('More recent products from network'), | |
| 241 | 244 | }[asset.to_s + '_' + filter] |
| 242 | 245 | end |
| 243 | 246 | ... | ... |
app/helpers/search_helper.rb
| ... | ... | @@ -124,7 +124,7 @@ module SearchHelper |
| 124 | 124 | |
| 125 | 125 | def order_by(asset) |
| 126 | 126 | options = { |
| 127 | - :products => [[_('Relevance'), ''], [_('Name'), 'name_or_category_sort asc'], [_('Lower price'), 'price_sort asc'], [_('Higher price'), 'price_sort desc']], | |
| 127 | + :products => [[_('Relevance'), ''], [_('More Recent'), 'updated_at desc'], [_('Name'), 'name_or_category_sort asc'], [_('Lower price'), 'price_sort asc'], [_('Higher price'), 'price_sort desc']], | |
| 128 | 128 | :events => [[_('Relevance'), ''], [_('Name'), 'name_sort asc']], |
| 129 | 129 | :articles => [[_('Relevance'), ''], [_('Name'), 'name_sort asc'], [_('Most recent'), 'updated_at desc']], |
| 130 | 130 | :enterprises => [[_('Relevance'), ''], [_('Name'), 'name_sort asc']], | ... | ... |