2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/migrations/yodel/07_search_page_model.rb', line 2
def self.up(site)
operators = [ 'Equals', 'Not Equal', 'Greater Than',
'Less Than', 'Greater Than or Equal To',
'Less Than or Equal To', 'In']
site.pages.create_model :search_pages do |search_pages|
add_field :sort, :string, searchable: false
add_field :limit, :integer
add_field :skip, :integer
add_one :type, model: :model
add_embed_many :conditions do
add_field :name, :string
add_field :value, :string
add_field :operator, :enum, options: operators
end
add_embed_many :user_conditions, default: [{name: 'search_keywords', as: 'query', operator: 'In'}] do
add_field :name, :string
add_field :as, :string
add_field :operator, :enum, options: operators
end
search_pages.record_class_name = 'SearchPage'
end
end
|