This is only available in the Enterprise Edition. Please add your [license key](/self-hosting/license-key) to activate it.
</Note>
A **search context** is a user-defined grouping of repositories that helps focus searches on specific areas of your codebase, like frontend, backend, or infrastructure code. Some example queries using search contexts:
- `context:data_engineering userId` - search for `userId` across all repos related to Data Engineering.
- `context:k8s ingress` - search for anything related to ingresses in your k8's configs.
- `( context:project1 or context:project2 ) logger\.debug` - search for debug log calls in project1 and project2
Search contexts are defined in the `context` object inside of a [declarative config](/self-hosting/more/declarative-config). Repositories can be included / excluded from a search context by specifying the repo's URL in either the `include` array or `exclude` array. Glob patterns are supported.
## Example
Let's assume we have a GitLab instance hosted at `https://gitlab.example.com` with three top-level groups, `web`, `backend`, and `shared`:
```sh
web/
├─ admin_panel/
├─ customer_portal/
├─ pipelines/
├─ ...
backend/
├─ billing_server/
├─ auth_server/
├─ db_migrations/
├─ pipelines/
├─ ...
shared/
├─ protobufs/
├─ react/
├─ pipelines/
├─ ...
```
To make searching easier, we can create three search contexts in our [config.json](/self-hosting/more/declarative-config):