Sha256: 94cffa31b0adffed779b7d4e6ce5b0e05a47575cf52b7cf353c16c8ff3112454

Contents?: true

Size: 971 Bytes

Versions: 3

Compression:

Stored size: 971 Bytes

Contents

# Need to sub-class CatalogController so we get all other plugins behavior
# for our own "inside a search context" lookup of facets. 
class BlacklightAdvancedSearch::AdvancedController < CatalogController

  def index
    unless request.method==:post
      @response = get_advanced_search_facets
    end
  end

  protected

  # Override to use the engine routes
  def search_action_url options = {}
    blacklight_advanced_search_engine.url_for(options.merge(action: 'index'))
  end

  def get_advanced_search_facets
    # We want to find the facets available for the current search, but:
    # * IGNORING current query (add in facets_for_advanced_search_form filter)
    # * IGNORING current advanced search facets (remove add_advanced_search_to_solr filter)
    response, _ = search_results(params) do |search_builder|
      search_builder.except(:add_advanced_search_to_solr).append(:facets_for_advanced_search_form)            
    end

    return response
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
blacklight_advanced_search-6.0.2 app/controllers/blacklight_advanced_search/advanced_controller.rb
blacklight_advanced_search-6.0.1 app/controllers/blacklight_advanced_search/advanced_controller.rb
blacklight_advanced_search-6.0.0 app/controllers/blacklight_advanced_search/advanced_controller.rb