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

@@ -67,7 +67,7 @@ func TestRevealCutsEachGroupAndRecordsTheFieldsReturned(t *testing.T) {
policy := domain.DemoMatchingPolicy()
policy.MaxResultsPerGroup = 2
views := newViewsFake(10)
result, err := revealService(views).reveal(context.Background(), nil, Request{}, policy, groups{
result, err := revealService(views).reveal(context.Background(), nil, Request{}, policy, needSemantics{}, groups{
main: []rankedEntry{confirmedItem(first), confirmedItem(second), confirmedItem(uuid.New())},
unconfirmed: []rankedEntry{declaredItem(first, domain.SpecializationNetworkEngineer)},
})
@@ -97,7 +97,7 @@ func TestRevealCutsEachGroupAndRecordsTheFieldsReturned(t *testing.T) {
func TestRevealReturnsThePrefixThatIsPaidForWhenTheAllowanceEnds(t *testing.T) {
ids := []uuid.UUID{uuid.New(), uuid.New(), uuid.New(), uuid.New()}
views := newViewsFake(2)
result, err := revealService(views).reveal(context.Background(), nil, Request{}, domain.DemoMatchingPolicy(), groups{
result, err := revealService(views).reveal(context.Background(), nil, Request{}, domain.DemoMatchingPolicy(), needSemantics{}, groups{
main: []rankedEntry{confirmedItem(ids[0])},
near: []rankedEntry{confirmedItem(ids[1]), confirmedItem(ids[2])},
unconfirmed: []rankedEntry{declaredItem(ids[0], domain.SpecializationNetworkEngineer), declaredItem(ids[3], domain.SpecializationQA)},
@@ -116,13 +116,13 @@ func TestRevealReturnsThePrefixThatIsPaidForWhenTheAllowanceEnds(t *testing.T) {
func TestRevealDoesNotFlagACompleteResult(t *testing.T) {
views := newViewsFake(5)
result, err := revealService(views).reveal(context.Background(), nil, Request{}, domain.DemoMatchingPolicy(), groups{
result, err := revealService(views).reveal(context.Background(), nil, Request{}, domain.DemoMatchingPolicy(), needSemantics{}, groups{
main: []rankedEntry{confirmedItem(uuid.New())},
})
if err != nil || result.Truncated || len(result.Main) != 1 {
t.Fatalf("reveal() = %+v, %v, want one entry that is not truncated", result, err)
}
empty, err := revealService(newViewsFake(0)).reveal(context.Background(), nil, Request{}, domain.DemoMatchingPolicy(), groups{})
empty, err := revealService(newViewsFake(0)).reveal(context.Background(), nil, Request{}, domain.DemoMatchingPolicy(), needSemantics{}, groups{})
if err != nil || empty.Truncated || len(empty.Main)+len(empty.Near)+len(empty.Unconfirmed) != 0 {
t.Fatalf("an empty search = %+v, %v, want an empty result that is not truncated", empty, err)
}