feat(matching): rank with semantic embeddings and explain matches by evidence
This commit is contained in:
1 parent
facc1789b1
commit
24b64d698a
215 files changed
+16951
-327
No files matched your search
@@ -37,6 +37,7 @@ import (
|
||||
"lincodex/backend/internal/usecase/organization"
|
||||
"lincodex/backend/internal/usecase/policy"
|
||||
profileusecase "lincodex/backend/internal/usecase/profile"
|
||||
"lincodex/backend/internal/usecase/semantic"
|
||||
)
|
||||
|
||||
const matchSearchHTTPTimeout = 15 * time.Minute
|
||||
@@ -50,6 +51,13 @@ type matchSearchHarness struct {
|
||||
}
|
||||
|
||||
func newMatchSearchHarness(ctx context.Context, t *testing.T, env *testEnvironment) *matchSearchHarness {
|
||||
t.Helper()
|
||||
return newMatchSearchHarnessWithSemantic(ctx, t, env, nil)
|
||||
}
|
||||
|
||||
// newMatchSearchHarnessWithSemantic wires the semantic trigger into the
|
||||
// profile, publication, and need operations; nil schedules nothing.
|
||||
func newMatchSearchHarnessWithSemantic(ctx context.Context, t *testing.T, env *testEnvironment, trigger *semantic.Trigger) *matchSearchHarness {
|
||||
t.Helper()
|
||||
var key domain.CandidateViewPseudonymKey
|
||||
var organizationHandler *v1.OrganizationHandler
|
||||
@@ -71,7 +79,15 @@ func newMatchSearchHarness(ctx context.Context, t *testing.T, env *testEnvironme
|
||||
if err != nil {
|
||||
t.Fatalf("candidateview.NewService() error = %v", err)
|
||||
}
|
||||
settings, err := candidateprivacy.NewService(candidateprivacy.Dependencies{Transactor: parts.transactor, Clock: parts.clock.Now})
|
||||
privacyDependencies := candidateprivacy.Dependencies{Transactor: parts.transactor, Clock: parts.clock.Now}
|
||||
needDependencies := needusecase.Dependencies{Transactor: parts.transactor, Keyring: parts.keyring, Clock: parts.clock.Now}
|
||||
profileService := profileusecase.NewService(parts.transactor, parts.clock.Now)
|
||||
if trigger != nil {
|
||||
privacyDependencies.Semantic = trigger
|
||||
needDependencies.Semantic = trigger
|
||||
profileService = profileService.WithSemantic(trigger, semanticCheckInterval)
|
||||
}
|
||||
settings, err := candidateprivacy.NewService(privacyDependencies)
|
||||
if err != nil {
|
||||
t.Fatalf("candidateprivacy.NewService() error = %v", err)
|
||||
}
|
||||
@@ -81,9 +97,7 @@ func newMatchSearchHarness(ctx context.Context, t *testing.T, env *testEnvironme
|
||||
if err != nil {
|
||||
t.Fatalf("organization.NewService() error = %v", err)
|
||||
}
|
||||
needService, err := needusecase.NewService(needusecase.Dependencies{
|
||||
Transactor: parts.transactor, Keyring: parts.keyring, Clock: parts.clock.Now,
|
||||
})
|
||||
needService, err := needusecase.NewService(needDependencies)
|
||||
if err != nil {
|
||||
t.Fatalf("need.NewService() error = %v", err)
|
||||
}
|
||||
@@ -110,7 +124,7 @@ func newMatchSearchHarness(ctx context.Context, t *testing.T, env *testEnvironme
|
||||
return []v1.HandlerOption{
|
||||
v1.WithEvidence(v1.NewEvidenceHandler(evidenceService)),
|
||||
v1.WithPrivacy(v1.NewPrivacyHandler(views, settings, env.Config.AppPublicURL)),
|
||||
v1.WithProfile(v1.NewProfileHandler(profileusecase.NewService(parts.transactor, parts.clock.Now))),
|
||||
v1.WithProfile(v1.NewProfileHandler(profileService)),
|
||||
v1.WithOrganization(organizationHandler),
|
||||
v1.WithNeed(v1.NewNeedHandler(needService)),
|
||||
v1.WithMatches(v1.NewMatchHandler(search)),
|
||||
|
||||
Reference in new issue
Block a user