Select the types of activity you want to include in your feed.
Add RepoIds filter to /api/search based on new RepoIds query primitive (#521)
This is a new parameter that can be passed in the request body to filter
searches to a list of repositories by `repoid`. This makes use of a new
`RepoIds` query filter.
···231231 return sb.String()
232232}
233233234234+// NewRepoIDs is a helper for creating a RepoIDs which
235235+// searches only the matched repos.
236236+func NewRepoIDs(ids ...uint32) *RepoIDs {
237237+ return &RepoIDs{Repos: roaring.BitmapOf(ids...)}
238238+}
239239+240240+func (q *RepoIDs) String() string {
241241+ var sb strings.Builder
242242+243243+ sb.WriteString("(repoids ")
244244+245245+ if size := q.Repos.GetCardinality(); size > 1 {
246246+ sb.WriteString("count:" + strconv.FormatUint(size, 10))
247247+ } else {
248248+ sb.WriteString("repoid=" + q.Repos.String())
249249+ }
250250+251251+ sb.WriteString(")")
252252+ return sb.String()
253253+}
254254+234255// MarshalBinary implements a specialized encoder for BranchesRepos.
235256func (q BranchesRepos) MarshalBinary() ([]byte, error) {
236257 return branchesReposEncode(q.List)
···247268type BranchRepos struct {
248269 Branch string
249270 Repos *roaring.Bitmap
271271+}
272272+273273+// Similar to BranchRepos but will be used to match only by repoid and
274274+// therefore matches all branches
275275+type RepoIDs struct {
276276+ Repos *roaring.Bitmap
250277}
251278252279// RepoSet is a list of repos to match. It is a Sourcegraph addition and only