I have the following search query for products using searchkick:
def index
@filter = params[:filter].blank? ? nil : Search.find(params[:filter])
if @filter.present?
@products = @filter.products(set_order_column(@sort), @direction, params[:page], @per_page)
else
query = @query.presence || "*"
@products = Product.search(
query,
where: {
active: true
},
page: params[:page],
per_page: @per_page,
order: [{
"#{set_order_column(@sort)}" => "#{@direction}"
}],
misspellings: { distance: 2 },
fields: fields)
end
@filter_product_ids = @products.map(&:id)
end
There is the variable filter_product_ids where I need to store all results not filtered results by @per_page. Is it possible to do that? Right now, there are results just for results @per_page.
The goal to get all the results without pagination is to get uniq values for all products used to various product categorization for filtering on the website.
Thank you for any hints, Miroslav