Module: Para::SearchHelper
- Defined in:
- app/helpers/para/search_helper.rb
Instance Method Summary collapse
- #distinct_search_results(search) ⇒ Object
- #filtered?(attributes) ⇒ Boolean
- #fulltext_search_param_for(attributes) ⇒ Object
- #searchable_attributes(attributes) ⇒ Object
Instance Method Details
#distinct_search_results(search) ⇒ Object
19 20 21 |
# File 'app/helpers/para/search_helper.rb', line 19 def distinct_search_results(search) Para::Search::Distinct.new(search).result end |
#filtered?(attributes) ⇒ Boolean
7 8 9 |
# File 'app/helpers/para/search_helper.rb', line 7 def filtered?(attributes) params[:q] && params[:q][fulltext_search_param_for(attributes)].present? end |
#fulltext_search_param_for(attributes) ⇒ Object
3 4 5 |
# File 'app/helpers/para/search_helper.rb', line 3 def fulltext_search_param_for(attributes) "#{ searchable_attributes(attributes) }_cont" end |
#searchable_attributes(attributes) ⇒ Object
11 12 13 14 15 16 17 |
# File 'app/helpers/para/search_helper.rb', line 11 def searchable_attributes(attributes) whitelist = attributes.select(&:searchable?) whitelist.map do |attribute| attribute.attribute_column_path.join('_') end.join('_or_') end |