Skip to content

Commit

Permalink
Change databuilder search data extractors to publish name in user d…
Browse files Browse the repository at this point in the history
…ocument.

Signed-off-by: Jackson Goerner <[email protected]>
  • Loading branch information
glipR committed Oct 23, 2024
1 parent e4a887f commit b134aac
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 1 deletion.
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
2 changes: 2 additions & 0 deletions databuilder/databuilder/models/user_elasticsearch_document.py
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

0 comments on commit b134aac

Please sign in to comment.