Sha256: 5d46e8ee87e49a2453e1fef1fc989730933b9377133dd8b6295f890027533b5f

Contents?: true

Size: 989 Bytes

Versions: 4

Compression:

Stored size: 989 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
    @nav_li_active = 'search'
    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

4 entries across 4 versions & 1 rubygems

Version Path
commonwealth-vlr-engine-0.0.7 app/controllers/blacklight_advanced_search/advanced_controller.rb
commonwealth-vlr-engine-0.0.4 app/controllers/blacklight_advanced_search/advanced_controller.rb
commonwealth-vlr-engine-0.0.3 app/controllers/blacklight_advanced_search/advanced_controller.rb
commonwealth-vlr-engine-0.0.2 app/controllers/blacklight_advanced_search/advanced_controller.rb