app/controllers/search_controller.rb
# This controller is no longer used but I'm keeping it here just in case
# All searches are model-specific and are integrated into the index actions for the respective controllers
This controller is no longer used but I'm keeping it here just in case
All searches are model-specific and are integrated into the index actions for the respective controllers
This controller is no longer used but I ' m keeping it here just in case All searches are model - specific and are integrated into the index actions for the respective controllers
def index
    @q = params[:q]
    @page = params[:page] || 1
    @per_page = params[:per_page] || 20
    @total = Order.count
    @pages = (@total.to_f / @per_page.to_i).ceil
    @sort = params[:sort] || :id
    if params[:reset_filters]
      params[:filters] = {}
    else
      params[:filters] ||= {}
    end
    @filters = params[:filters] || {}
    params[:filters].delete_if { |k,v| v.blank? }
    params.each do |k,v|
      if v == '0'
        params[k] = false
      end
    end
    @filters = !params[:filters].blank? ? params[:filters].clone : {}
    s = Search.new(params)
    @solr_response = s.execute
    render json: @solr_response
  end
def index @q = params [ :q ] @page = params [ :page ] || 1 @per_page = params [ :per_page ] || 20 @total = Order . count @pages = ( @total . to_f / @per_page . to_i ) . ceil @sort = params [ :sort ] || :id if params [ :reset_filters ] params [ :filters ] = { } else params [ :filters ] ||= { } end @filters = params [ :filters ] || { } params [ :filters ] . delete_if { | k , v | v . blank? } params . each do | k , v | if v == '0' params [ k ] = false end end @filters = ! params [ :filters ] . blank? ? params [ :filters ] . clone : { } s = Search . new ( params ) @solr_response = s . execute render json : @solr_response end
This controller is no longer used but I'm keeping it here just in case
All searches are model-specific and are integrated into the index actions for the respective controllers
This controller is no longer used but I ' m keeping it here just in case All searches are model - specific and are integrated into the index actions for the respective controllers
###################################################################### # Process request params ###################################################################### # remove filters with no value # convert values of '0' to false # @filters only include facet values included in the request. Additional filters will be added to the query. # @api_response = { #   orders: @solr_response['response']['docs'].map { |d| JSON.parse(d['data']) }, #   meta: { pagination: pagination_params } # }