Skip to content

Commit

Permalink
more logging and type casting
Browse files Browse the repository at this point in the history
  • Loading branch information
epipav committed Jan 4, 2024
1 parent 2558ba6 commit c42e8d1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,23 @@ export async function getMergeSuggestions(
],
}

const membersToMerge: ISimilarMemberOpensearch[] =
(
await svc.opensearch.client.search({
index: OpenSearchIndex.MEMBERS,
body: similarMembersQueryBody,
})
).body?.hits?.hits || []
let membersToMerge: ISimilarMemberOpensearch[]

try {
membersToMerge =
(
await svc.opensearch.client.search({
index: OpenSearchIndex.MEMBERS,
body: similarMembersQueryBody,
})
).body?.hits?.hits || []
} catch (e) {
svc.log.info(
{ error: e, query: identitiesPartialQuery },
'Error while searching for similar members!',
)
throw e
}

for (const memberToMerge of membersToMerge) {
mergeSuggestions.push({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class MemberMergeSuggestionsRepository {
'toMergeId',
)})::uuid, $(${idPlaceholder('similarity')}), $(${idPlaceholder(
'activityEstimate',
)}), NOW(), NOW())`,
)})::integer, NOW(), NOW())`,
replacements: {
[idPlaceholder('memberId')]: memberId,
[idPlaceholder('toMergeId')]: toMergeId,
Expand Down

0 comments on commit c42e8d1

Please sign in to comment.