Saved Searches
This page provides docs about how Saved Searches work with Sourcegraph.
Saved Searches lets you reuse and share search queries. You can create a saved search for anything, including diffs and commits across all branches of your repositories.
Saved Searches functionality is available to both Free and Enterprise Code Search users. To access or create new Saved Searches in the Sourcegraph web app, click the Tools > Saved Searches in the top navigation bar.
Creating saved searches
To create a new saved search:
- Go to the Saved Searches section and click the New saved search button
- Fill out the description field and enter the search query
- While writing the query syntax, ensure to include the
patternType:
field
A patternType:
filter is required in the query for all saved searches. patternType
can be keyword
, standard
, literal
, or regexp
. You cannot create a saved search without defining the patternType:
field.
Enable the checkbox for Draft if you don't want other users to use your saved search. This is useful for testing the query before sharing it with others. Once done, click the Create saved search button to be redirected to the Saved Searches page.
Your saved search will appear with a Secret
label, which means that only you can view and use it. To let others use your saved search, you need to transfer it to an organization and ask the site admin to make it public.
In addition, you can also search within your saved searches and sort your saved searches by name, recently updated, and description.
Transfer ownership
To transfer ownership of a saved search, click the Edit button next to it, click the Transfer ownership button, and select the organization to which you want to transfer the saved search.
Example saved searches
See the search examples page for a useful list of searches to save.