Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions docs/docs/features/search/search-contexts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,38 @@ Like other prefixes, contexts can be negated using `-` or combined using `or`:

See [this doc](/docs/features/search/syntax-reference) for more details on the search query syntax.

## Filtering by topic

If your repositories are tagged with topics on [GitHub](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/classifying-your-repository-with-topics) or [GitLab](https://docs.gitlab.com/ee/user/project/topics.html), you can use `includeTopics` and `excludeTopics` to filter repositories by topic instead of (or in addition to) specifying individual repo URLs. Glob patterns are supported.

```json
{
"$schema": "https://raw.githubusercontent.com/sourcebot-dev/sourcebot/main/schemas/v3/index.json",
"contexts": {
"backend": {
"includeTopics": ["backend", "core-*"],
"excludeTopics": ["deprecated", "archived-*"],
"description": "Active backend services."
}
},
"connections": {
/* ...connection definitions... */
}
}
```

`includeTopics` and `excludeTopics` follow the same additive semantics as `include` and `exclude`:

- `includeTopics` adds all repos tagged with a matching topic to the context.
- `excludeTopics` removes repos tagged with a matching topic from the context.
- Both can be freely combined with `include`, `includeConnections`, `exclude`, and `excludeConnections`.

Topic matching is case-insensitive, so `"Backend"` matches the pattern `"backend"`.

<Note>
Topics are populated when a connection syncs. If you add topics to your repositories after the last sync, trigger a re-sync for the new topics to take effect.
</Note>

## Schema reference

<Accordion title="Reference">
Expand Down
52 changes: 52 additions & 0 deletions docs/snippets/schemas/v3/index.schema.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,32 @@
"type": "string"
}
},
"includeTopics": {
"type": "array",
"description": "List of GitLab topics to include in the search context. Only repositories matching at least one topic are included. Glob patterns are supported.",
"items": {
"type": "string"
},
"examples": [
[
"backend",
"core-*"
]
]
},
"excludeTopics": {
"type": "array",
"description": "List of GitLab topics to exclude from the search context. Repositories matching any of these topics are excluded. Glob patterns are supported.",
"items": {
"type": "string"
},
"examples": [
[
"deprecated",
"archived-*"
]
]
},
Comment thread
coderabbitai[bot] marked this conversation as resolved.
"description": {
"type": "string",
"description": "Optional description of the search context that surfaces in the UI."
Expand Down Expand Up @@ -313,6 +339,32 @@
"type": "string"
}
},
"includeTopics": {
"type": "array",
"description": "List of GitLab topics to include in the search context. Only repositories matching at least one topic are included. Glob patterns are supported.",
"items": {
"type": "string"
},
"examples": [
[
"backend",
"core-*"
]
]
},
"excludeTopics": {
"type": "array",
"description": "List of GitLab topics to exclude from the search context. Repositories matching any of these topics are excluded. Glob patterns are supported.",
"items": {
"type": "string"
},
"examples": [
[
"deprecated",
"archived-*"
]
]
},
"description": {
"type": "string",
"description": "Optional description of the search context that surfaces in the UI."
Expand Down
26 changes: 26 additions & 0 deletions docs/snippets/schemas/v3/searchContext.schema.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,32 @@
"type": "string"
}
},
"includeTopics": {
"type": "array",
"description": "List of GitLab topics to include in the search context. Only repositories matching at least one topic are included. Glob patterns are supported.",
"items": {
"type": "string"
},
"examples": [
[
"backend",
"core-*"
]
]
},
"excludeTopics": {
"type": "array",
"description": "List of GitLab topics to exclude from the search context. Repositories matching any of these topics are excluded. Glob patterns are supported.",
"items": {
"type": "string"
},
"examples": [
[
"deprecated",
"archived-*"
]
]
},
"description": {
"type": "string",
"description": "Optional description of the search context that surfaces in the UI."
Expand Down
Loading
Loading