Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def index
- if @category.present?
- @classifieds = @category.nested_classifieds
- nested_categories = []
- @category.nested_categories.each do |f|
- nested_categories << f.id
- end
- @search = Sunspot.search(Classified) do
- paginate(:page => params[:page] || 1, :per_page => 10)
- order_by(:created_at , :desc)
- fulltext params[:search]
- with(:categoryid,nested_categories)
- with(:price).less_than_or_equal_to(params[:prcmax].to_i) if params[:prcmax].present?
- with(:price).greater_than_or_equal_to(params[:prcmin].to_i) if params[:prcmin].present?
- active_model = with(:model ,params[:model]) if params[:model].present?
- active_make = with(:make , params[:make]) if params[:make].present?
- active_make_country = with(:make_country , params[:make_country]) if params[:make_country].present?
- active_condition = with(:condition,params[:condition]) if params[:condition].present?
- active_category = with(:cat,params[:cat]) if params[:cat].present?
- active_subcategory = with(:treecat,params[:treecat]) if params[:treecat].present?
- facet :price
- facet(:model)
- #facet(:model , exclude: active_condition)
- facet(:make)
- facet(:make_country)
- facet(:condition)
- facet(:cat)
- facet(:treecat)
- end
- @classifieds = @search.results
- else
- #redirect_to '/'
- #@classified=@search.results
- search
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement