feat(matching): rank with semantic embeddings and explain matches by evidence

This commit is contained in:
shira committed 2026-10-11 10:39:46 +03:00
1 parent facc1789b1
commit 24b64d698a
215 files changed
+16951 -327

No files matched your search

@@ -57,6 +57,9 @@ type privacyCohortCandidate struct {
acknowledgements []domain.ProfileParallelPeriodAcknowledgement
workFormats []domain.QuestionnaireWorkFormat
categories []domain.CandidateViewConfirmedCategoryInput
// verifiedRepositories holds the keys of the repositories whose latest
// check found them public.
verifiedRepositories map[string]bool
}
func (repository privacyCohortRepository) ListVisibleCandidateViewSources(
@@ -94,6 +97,7 @@ func (repository privacyCohortRepository) ListVisibleCandidateViewSources(
if err != nil {
return nil, fmt.Errorf("%s - restore candidate source: %w", location, err)
}
current.verifiedRepositories = verifiedRepositorySet(row.VerifiedRepositories)
}
if row.Kind.Valid {
claim, err := privacyCohortStoredClaim(row)
@@ -210,11 +214,22 @@ func buildPrivacyCohortSource(candidate privacyCohortCandidate) (domain.Candidat
return domain.CandidateViewSource{}, fmt.Errorf("validate safe profile claims: %w", domain.ErrInvalidCandidateViewSource)
}
return domain.NewCandidateViewSource(
candidate.id, candidate.fields, domain.CandidateViewProfileFromContent(content), candidate.categories,
candidate.workFormats, nil,
candidate.id, candidate.fields,
domain.CandidateViewProfileFromContentWithRepositories(content, candidate.verifiedRepositories),
candidate.categories, candidate.workFormats, nil,
)
}
// verifiedRepositorySet turns the keys of the verified repositories of one
// candidate into a set.
func verifiedRepositorySet(keys []string) map[string]bool {
set := make(map[string]bool, len(keys))
for _, key := range keys {
set[key] = true
}
return set
}
func privacyCohortJSONBytes(value any) ([]byte, error) {
switch typed := value.(type) {
case []byte: