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