Module: Blacklight::Facetable
- Extended by:
- ActiveSupport::Concern
- Included in:
- Catalog
- Defined in:
- app/controllers/concerns/blacklight/facetable.rb
Overview
The Facetable module can be included onto classes that need to initialize a FacetSearchService. There are two dependencies you must provide on the including class. Typically these would be provided by Blacklight::Controller
1. search_state
2. blacklight_config
Additionally, the including class may override the facet_search_service_context method to provide further context to the SearchService. For example you could override this to provide the currently signed in user.
Instance Method Summary collapse
- #facet_search_service ⇒ Blacklight::FacetSearchService
-
#facet_search_service_context ⇒ Hash
Override this method on the class that includes Blacklight::Facetable to provide more context to the search service if necessary.
Instance Method Details
#facet_search_service ⇒ Blacklight::FacetSearchService
23 24 25 |
# File 'app/controllers/concerns/blacklight/facetable.rb', line 23 def facet_search_service facet_search_service_class.new(config: blacklight_config, search_state: search_state, user_params: search_state.to_h, **facet_search_service_context) end |
#facet_search_service_context ⇒ Hash
Override this method on the class that includes Blacklight::Facetable to provide more context to the search service if necessary. For example, if your search builder needs to be aware of the current user, override this method to return a hash including the current user. Then the search builder could use some property about the current user to construct a constraint on the search.
31 32 33 |
# File 'app/controllers/concerns/blacklight/facetable.rb', line 31 def facet_search_service_context search_service_context end |