Class: WinewooCore::Repositories::Mongo::CriterionsMongoRepo::PictosFinder

Inherits:
Finder
  • Object
show all
Defined in:
lib/winewoo_core/repositories/mongo/criterions_mongo_repo.rb

Instance Method Summary collapse

Methods inherited from Finder

#map

Constructor Details

#initialize(category, query_param) ⇒ PictosFinder

Returns a new instance of PictosFinder.



144
145
146
147
# File 'lib/winewoo_core/repositories/mongo/criterions_mongo_repo.rb', line 144

def initialize(category, query_param)
  super(query_param)
  @category = category
end

Instance Method Details

#findObject



150
151
152
153
154
155
# File 'lib/winewoo_core/repositories/mongo/criterions_mongo_repo.rb', line 150

def find
  res = WinewooCore::Repositories::Mongo::Queries::PictoQuery.new.from_category(@category).by_name
  res = res.full_text_search @filters.query if @filters.query
  return res.page(@filters.page || 1)
    .per(@filters.per_page || Kaminari::config.default_per_page)
end