cirandas.net

ref: master

plugins/elasticsearch/lib/ext/event.rb


 1
 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
28
29
30
31
32
33
34
require_dependency 'event'

require_relative '../searchable_model_helper'
require_relative '../nested_helper/profile'

class Event
  #TODO: o filtro é feito de forma diferente do artigo

  def self.control_fields
    {
      :advertise => {type: :boolean},
      :published => {type: :boolean},
      :profile   => { type: :nested , hash: NestedProfile.hash }
    }
  end

  def self.should
    [
      { and: [
          { term: { advertise: true }},
          { term: { published: true }}
        ]
      }
    ]
  end

  def self.nested_filter
    [
      NestedProfile::filter
    ]
  end

  include SearchableModelHelper
end