diff --git a/app/models/application_model/search_index_base.rb b/app/models/application_model/search_index_base.rb index 863b9e481..01a2c0eea 100644 --- a/app/models/application_model/search_index_base.rb +++ b/app/models/application_model/search_index_base.rb @@ -18,11 +18,7 @@ returns return if !self.class.search_index_support_config # default ignored attributes - ignore_attributes = { - created_by_id: true, - updated_by_id: true, - active: true, - } + ignore_attributes = {} if self.class.search_index_support_config[:ignore_attributes] self.class.search_index_support_config[:ignore_attributes].each {|key, value| ignore_attributes[key] = value @@ -37,7 +33,7 @@ returns attributes = data.attributes ignore_attributes.each {|key, value| next if value != true - attributes.delete( key.to_s ) + attributes.delete(key.to_s) } # fill up with search data @@ -45,15 +41,7 @@ returns return if !attributes # update backend - if self.class.column_names.include? 'active' - if active - SearchIndexBackend.add( self.class.to_s, attributes ) - else - SearchIndexBackend.remove( self.class.to_s, id ) - end - else - SearchIndexBackend.add( self.class.to_s, attributes ) - end + SearchIndexBackend.add(self.class.to_s, attributes) end =begin diff --git a/app/models/ticket/search_index.rb b/app/models/ticket/search_index.rb index 75fc76b64..a18049a87 100644 --- a/app/models/ticket/search_index.rb +++ b/app/models/ticket/search_index.rb @@ -18,11 +18,7 @@ returns return if !self.class.search_index_support_config # default ignored attributes - ignore_attributes = { - created_by_id: true, - updated_by_id: true, - active: true, - } + ignore_attributes = {} if self.class.search_index_support_config[:ignore_attributes] self.class.search_index_support_config[:ignore_attributes].each {|key, value| ignore_attributes[key] = value @@ -62,7 +58,7 @@ returns article_attributes = article.attributes # remove note needed attributes - ignore = %w(created_by_id updated_by_id updated_at references message_id_md5 message_id in_reply_to ticket_id) + ignore = %w(message_id_md5) ignore.each {|attribute| article_attributes.delete( attribute ) } diff --git a/app/models/user.rb b/app/models/user.rb index 324509b29..3c76b8c40 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -28,7 +28,6 @@ class User < ApplicationModel load 'user/assets.rb' include User::Assets extend User::Search - include User::SearchIndex before_create :check_name, :check_email, :check_login, :check_password before_update :check_password, :check_email, :check_login diff --git a/app/models/user/search_index.rb b/app/models/user/search_index.rb deleted file mode 100644 index 870261db0..000000000 --- a/app/models/user/search_index.rb +++ /dev/null @@ -1,30 +0,0 @@ -# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/ - -class User - module SearchIndex - -=begin - -get data to store in search index - - user = User.find(123) - result = user.search_index_data - -returns - - result = true # false - -=end - - def search_index_data - attributes = { 'fullname' => "#{self['firstname']} #{self['lastname']}" } - %w(login firstname lastname phone email address city country note created_at).each { |key| - if self[key] && (!self.respond_to?('empty?') || !self[key].empty?) - attributes[key] = self[key] - end - } - return if attributes.empty? - attributes - end - end -end