Module: Spotlight::BrowseCategorySearchBuilder
- Extended by:
- ActiveSupport::Concern
- Included in:
- SearchBuilder
- Defined in:
- app/models/concerns/spotlight/browse_category_search_builder.rb
Overview
Enforce exhibit visibility for index queries
Instance Method Summary collapse
-
#apply_browse_category_defaults(solr_params) ⇒ Object
Adds a filter that excludes resources that have been marked as not-visible.
- #fix_up_browse_category_defaults(solr_params) ⇒ Object
- #fix_up_browse_category_queries(solr_params) ⇒ Object
Instance Method Details
#apply_browse_category_defaults(solr_params) ⇒ Object
Adds a filter that excludes resources that have been marked as not-visible
15 16 17 18 19 |
# File 'app/models/concerns/spotlight/browse_category_search_builder.rb', line 15 def apply_browse_category_defaults(solr_params) return unless current_browse_category solr_params.merge!(browse_category_search_builder.to_hash) end |
#fix_up_browse_category_defaults(solr_params) ⇒ Object
21 22 23 24 25 |
# File 'app/models/concerns/spotlight/browse_category_search_builder.rb', line 21 def fix_up_browse_category_defaults(solr_params) return if current_browse_category.nil? || search_state.send(:sort_field_key).present? solr_params[:sort] = browse_category_search_builder.sort end |
#fix_up_browse_category_queries(solr_params) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'app/models/concerns/spotlight/browse_category_search_builder.rb', line 27 def fix_up_browse_category_queries(solr_params) return unless solr_params.dig(:json, :query, :bool, :must) && blacklight_params[:q] # This replicates existing spotlight 2.x search behavior, more or less. It # doesn't take into account the possibility that the browse category query # could use a different search field (which.. doesn't have an existing UI # control.. and may require additional upstream work to properly encapsulate # the two query parameters) solr_params[:json][:query][:bool][:must].map! do |q| q.is_a?(String) ? { edismax: { query: q } } : q end end |