Project

General

Profile

Download (564 Bytes) Statistics
| Branch: | Tag: | Revision:

foreman_pipeline / app / models / foreman_pipeline / glue / elastic_search / base_model.rb @ be52ca64

1
module ForemanPipeline
2
  module Glue::ElasticSearch::BaseModel
3

    
4
    def self.included(base)
5
      base.send :include, Katello::Ext::IndexedModel
6

    
7
      base.class_eval do
8
        index_options :extended_json => :extended_index_attrs,
9
                      :display_attrs => [:name]
10
        mapping do
11
          indexes :name, :type => 'string', :analyzer => :kt_name_analyzer
12
          indexes :name_sort, :type => 'string', :index => :not_analyzed
13
        end
14
      end
15
    end
16

    
17
    def extended_index_attrs
18
      {:name_sort => name.downcase}
19
    end
20
  end  
21
end