Class: Api::V1::SearchController

Inherits:
ApplicationController
  • Object
show all
Includes:
Gemgento::Api::V1::Base, Gemgento::Api::V1::ProductFilters
Defined in:
app/controllers/gemgento/api/v1/search_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



6
7
8
9
10
11
# File 'app/controllers/gemgento/api/v1/search_controller.rb', line 6

def index
  @products = Gemgento::Search.products(params[:query])
  @products = @products.where(basic_filters)
  @products = @products.filter(attribute_filters, current_store) if attribute_filters.any?
  @products = @products.page(@page[:number]).per(@page[:size])
end