Commit 340ff99e11c31a34564063d42f3c2a7c0cc643d0
1 parent
bfec559e
Exists in
master
and in
28 other branches
Add new facet of profile type on profiles' searches
Showing
1 changed file
with
11 additions
and
1 deletions
Show diff stats
plugins/solr/lib/ext/profile.rb
... | ... | @@ -14,10 +14,11 @@ class Profile |
14 | 14 | :solr_plugin_f_enabled => {:label => _('Situation'), :type_if => proc { |klass| klass.kind_of?(Enterprise) }, |
15 | 15 | :proc => proc { |id| solr_plugin_f_enabled_proc(id) }}, |
16 | 16 | :solr_plugin_f_region => {:label => _('City'), :proc => proc { |id| solr_plugin_f_region_proc(id) }}, |
17 | + :solr_plugin_f_profile_type => {:label => _('Type'), :proc => proc{|klass| solr_plugin_f_profile_type_proc(klass)}}, | |
17 | 18 | :solr_plugin_f_categories => {:multi => true, :proc => proc {|facet, id| solr_plugin_f_categories_proc(facet, id)}, |
18 | 19 | :label => proc { |env| solr_plugin_f_categories_label_proc(env) }, :label_abbrev => proc{ |env| solr_plugin_f_categories_label_abbrev_proc(env) }}, |
19 | 20 | }, :category_query => proc { |c| "solr_plugin_category_filter:#{c.id}" }, |
20 | - :order => [:solr_plugin_f_region, :solr_plugin_f_categories, :solr_plugin_f_enabled] | |
21 | + :order => [:solr_plugin_f_region, :solr_plugin_f_categories, :solr_plugin_f_enabled, :solr_plugin_f_profile_type] | |
21 | 22 | |
22 | 23 | acts_as_searchable :fields => facets_fields_for_solr + [:solr_plugin_extra_data_for_index, |
23 | 24 | # searched fields |
... | ... | @@ -117,4 +118,13 @@ class Profile |
117 | 118 | def solr_plugin_name_sortable |
118 | 119 | name |
119 | 120 | end |
121 | + | |
122 | + def solr_plugin_f_profile_type | |
123 | + self.class.name | |
124 | + end | |
125 | + | |
126 | + def self.solr_plugin_f_profile_type_proc klass | |
127 | + klass.constantize.type_name | |
128 | + end | |
129 | + | |
120 | 130 | end | ... | ... |