Skip to content

Commit 6c322fb

Browse files
authored
1 parent ee0e50e commit 6c322fb

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

docs/code-search/working/search_contexts.mdx

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,35 @@ You can also search across multiple contexts at once using the `OR` [boolean ope
3737

3838
To organize your search contexts better, you can use a specific context as your default and star any number of contexts. This affects what context is selected when loading Sourcegraph and how the list of contexts is sorted.
3939

40-
### Default context
40+
### Default search context
41+
42+
#### For users
4143

4244
Any authenticated user can use a search context as their default. To set a default, go to the search context management page, open the "..." menu for a context, and click on "Use as default". If the user doesn't have a default, `global` will be used.
4345

4446
If a user ever loses access to their default search context (eg. the search context is made private), they will see a warning at the top of the search contexts dropdown menu list and `global` will be used. If a user's default search context is deleted, `global` will immediately be set as their default.
4547

4648
The default search context is always selected when loading the Sourcegraph webapp. The one exception is when opening a link to a search query that does not contain a `context:` filter, in which case the `global` context will be used.
4749

50+
#### For site admins
51+
52+
Site admins can set a default search context for all users on the Sourcegraph instance. This helps teams improve onboarding and search quality by focusing searches on the most relevant parts of the codebase rather than the entire indexed set of repositories.
53+
54+
An admin can set a default search context via:
55+
56+
- Click the **More** button from the top menu of the Sourcegraph web app
57+
- Next, go to **Search Contexts**
58+
- For the existing context list, click on the **...** menu and select **[Site admin only] Set as default for all users**
59+
- Alternatively, you can create a new context and then set it for all users via the same option
60+
61+
![admin-level-default-context](https://storage.googleapis.com/sourcegraph-assets/Docs/admin-default-context.png)
62+
63+
Here are a few considerations:
64+
65+
- If a user already has a personal default search context set, it will not be overridden
66+
- The admin-set default will apply automatically if a user only uses the global context
67+
- Individual users can see the instance-wide default and override it with their own default if they choose
68+
4869
### Starred contexts
4970

5071
Any authenticated user can star a search context. To star a context, click on the star icon in the search context management page. This will cause the context to appear near the top of their search contexts list. The `global` context cannot be starred.

0 commit comments

Comments
 (0)