fork of https://github.com/sourcegraph/zoekt
0

Configure Feed

Select the types of activity you want to include in your feed.

eval: simplify query.RawConfig (#833)

While working on scoring I noticed that public repos always have an
advantage compared to private repos, because we have
`doc(rawConfig:RcOnlyPublic|...)` as part of the matchtree, which
contributues +1 to the atom count.

Test plan:
New unit test

+18
+2
eval.go
··· 75 75 return d.simplifyMultiRepo(q, func(repo *Repository) bool { 76 76 return r.Set[repo.Name] 77 77 }) 78 + case query.RawConfig: 79 + return d.simplifyMultiRepo(q, func(repo *Repository) bool { return uint8(r)&encodeRawConfig(repo.RawConfig) == uint8(r) }) 78 80 case *query.RepoIDs: 79 81 return d.simplifyMultiRepo(q, func(repo *Repository) bool { 80 82 return r.Repos.Contains(repo.ID)
+16
eval_test.go
··· 329 329 } 330 330 } 331 331 332 + func TestSimplifyRcRawConfig(t *testing.T) { 333 + d := compoundReposShard(t, "foo", "bar") 334 + var all = query.RcOnlyPrivate | query.RcNoForks | query.RcNoArchived 335 + 336 + got := d.simplify(all) 337 + if d := cmp.Diff(&query.Const{Value: true}, got); d != "" { 338 + t.Fatalf("-want, +got:\n%s", d) 339 + } 340 + 341 + var none = query.RcOnlyPublic | query.RcNoForks | query.RcNoArchived 342 + got = d.simplify(none) 343 + if d := cmp.Diff(&query.Const{Value: false}, got); d != "" { 344 + t.Fatalf("-want, +got:\n%s", d) 345 + } 346 + } 347 + 332 348 func TestSimplifyBranchesRepos(t *testing.T) { 333 349 d := compoundReposShard(t, "foo", "bar") 334 350