cirandas.net

ref: master

plugins/elasticsearch/lib/ext/uploaded_file.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
require_dependency 'uploaded_file'

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

class UploadedFile
  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