Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Change databuilder search data extractors to publish name in user document. #2274

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ class AtlasSearchDataExtractor(Extractor):
lambda x: AtlasSearchDataExtractorHelpers.get_badges_from_classifications(x), [])
],
'User': [
('name', 'attributes.full_name', None, ''),
('email', 'attributes.qualifiedName', None, ''),
('first_name', 'attributes.first_name', None, ''),
('last_name', 'attributes.last_name', None, ''),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,7 @@ def _user_search(session: Session, published_tag: str, limit: int) -> List[Dict]

manager_email = user.manager.email if user.manager else ''
user_result = dict(email=user.email,
name=user.full_name,
first_name=user.first_name,
last_name=user.last_name,
full_name=user.full_name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class Neo4jSearchDataExtractor(Extractor):
where user.full_name is not null
return user.email as email, user.first_name as first_name, user.last_name as last_name,
user.full_name as full_name, user.github_username as github_username, user.team_name as team_name,
user.employee_type as employee_type, manager.email as manager_email,
user.employee_type as employee_type, manager.email as manager_email, user.full_name as name,
user.slack_id as slack_id, user.is_active as is_active, user.role_name as role_name,
REDUCE(sum_r = 0, r in COLLECT(DISTINCT read)| sum_r + r.read_count) AS total_read,
count(distinct b) as total_own,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ def _user_search_query(graph: GraphTraversalSource, tag_filter: str) -> List[Dic
'total_own',
'total_follow'
)
traversal = traversal.by('full_name') # name
traversal = traversal.by('email') # email
traversal = traversal.by('first_name') # first_name
traversal = traversal.by('last_name') # last_name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class UserESDocument(ElasticsearchDocument):
"""

def __init__(self,
name: str,
email: str,
first_name: str,
last_name: str,
Expand All @@ -25,6 +26,7 @@ def __init__(self,
total_own: int,
total_follow: int,
) -> None:
self.name = name
self.email = email
self.first_name = first_name
self.last_name = last_name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ def test_user_search(self,
manager = User(rk='test_manager_key', email='[email protected]')
user.manager = manager

expected_dict = dict(email='[email protected]',
expected_dict = dict(name='test_first_name test_last_name',
email='[email protected]',
first_name='test_first_name',
last_name='test_last_name',
full_name='test_full_name',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ def test_to_json(self) -> None:
"""
Test string generated from to_json method
"""
test_obj = UserESDocument(email='[email protected]',
test_obj = UserESDocument(name='test_firstname test_lastname',
email='[email protected]',
first_name='test_firstname',
last_name='test_lastname',
full_name='full_name',
Expand Down
Loading