Class: Landable::PageSearchEngine

Inherits:
SearchEngine show all
Defined in:
app/models/landable/page_search_engine.rb

Instance Method Summary collapse

Methods inherited from SearchEngine

#limit!, #meta, #order!, #results

Constructor Details

#initialize(filters, options = {}) ⇒ PageSearchEngine

Returns a new instance of PageSearchEngine.



6
7
8
# File 'app/models/landable/page_search_engine.rb', line 6

def initialize(filters, options = {})
  super Page.all, filters, options
end

Instance Method Details

#filter_by!(filters) ⇒ Object



10
11
12
13
14
15
16
17
# File 'app/models/landable/page_search_engine.rb', line 10

def filter_by!(filters)
  ids = as_array(filters[:ids])
  @scope = @scope.where(page_id: ids) if ids

  path = filters[:path].presence
  return unless path
  @scope = @scope.with_fuzzy_path(path)
end