You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is only available in the Enterprise Edition. Please add your [license key](/self-hosting/license-key) to activate it.
8
8
</Note>
9
9
10
-
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. This reduces noise in search results and improves developer productivity.
10
+
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:
11
11
12
-
## Getting started
12
+
-`context:data_engineering userId` - search for `userId` across all repos related to Data Engineering.
13
+
-`context:k8s ingress` - search for anything related to ingresses in your k8's configs.
14
+
-`( context:project1 or context:project2 ) logger\.debug` - search for debug log calls in project1 and project2
13
15
14
-
<Note>
15
-
The following will walkthrough an example of how search contexts can be used. For a full reference, see [here](#schema-reference).
16
-
</Note>
16
+
17
+
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.
18
+
19
+
## Example
17
20
18
21
Let's assume we have a GitLab instance hosted at `https://gitlab.example.com` with three top-level projects, `web`, `backend`, and `shared`:
19
22
@@ -36,51 +39,59 @@ shared/
36
39
├─ ...
37
40
```
38
41
39
-
To make searching easier, we can create three search contexts:
42
+
To make searching easier, we can create three search contexts in our [config.json](/self-hosting/more/declarative-config):
40
43
-`web`: For all frontend-related code
41
44
-`backend`: For backend services and shared APIs
42
45
-`pipelines`: For all CI/CD configurations
43
46
44
-
Add these contexts to your [config.json](/self-hosting/more/declarative-config):
0 commit comments