Push users.preferences to elasticsearch to enable searches for certain features.
This commit is contained in:
parent
e460c99cad
commit
34c14a22b5
3 changed files with 4 additions and 7 deletions
|
@ -72,8 +72,7 @@ class User < ApplicationModel
|
|||
:image,
|
||||
:image_source,
|
||||
:source,
|
||||
:login_failed,
|
||||
:preferences
|
||||
:login_failed
|
||||
|
||||
def ignore_search_indexing?(_action)
|
||||
# ignore internal user
|
||||
|
|
|
@ -50,11 +50,6 @@ returns
|
|||
def search_index_data
|
||||
attributes = {}
|
||||
self.attributes.each do |key, value|
|
||||
next if key == 'created_at'
|
||||
next if key == 'updated_at'
|
||||
next if key == 'created_by_id'
|
||||
next if key == 'updated_by_id'
|
||||
next if key == 'preferences'
|
||||
next if key == 'password'
|
||||
next if !value
|
||||
next if value.respond_to?('blank?') && value.blank?
|
||||
|
|
|
@ -114,6 +114,7 @@ class ElasticsearchTest < ActiveSupport::TestCase
|
|||
assert_equal('E', attributes['firstname'])
|
||||
assert_equal('S', attributes['lastname'])
|
||||
assert_equal('es-agent@example.com', attributes['email'])
|
||||
assert(attributes['preferences'])
|
||||
assert_not(attributes['password'])
|
||||
assert_not(attributes['organization'])
|
||||
|
||||
|
@ -121,6 +122,7 @@ class ElasticsearchTest < ActiveSupport::TestCase
|
|||
assert_equal('E', attributes['firstname'])
|
||||
assert_equal('S', attributes['lastname'])
|
||||
assert_equal('es-agent@example.com', attributes['email'])
|
||||
assert(attributes['preferences'])
|
||||
assert_not(attributes['password'])
|
||||
assert_not(attributes['organization'])
|
||||
|
||||
|
@ -128,6 +130,7 @@ class ElasticsearchTest < ActiveSupport::TestCase
|
|||
assert_equal('ES', attributes['firstname'])
|
||||
assert_equal('Customer1', attributes['lastname'])
|
||||
assert_equal('es-customer1@example.com', attributes['email'])
|
||||
assert(attributes['preferences'])
|
||||
assert_not(attributes['password'])
|
||||
assert_equal('Customer Organization Update', attributes['organization'])
|
||||
|
||||
|
|
Loading…
Reference in a new issue