# Search-based Code Navigation

<TierCallout>
	Supported on [Enterprise](/pricing/plans/enterprise) plans.
	<user>
		Available via VS Code and JetBrains editor extensions and the Web.
	</user>
</TierCallout>

<p className="subtitle">
	Learn and understand about Search-based Code Navigation.
</p>

Sourcegraph comes with a default built-in code navigation provided by search-based heuristics. It works out of the box with all of the most popular programming languages.

## How does it work?

Search-based Code Navigation provides 3-core navigation features:

-   **Jump to definition**: Performs a [symbol search](/code-search/features#symbol-search).
-   **Hover documentation**: First, finds the definition. Then, extracts documentation from comments near the definition.
-   **Find references**: Performs a case-sensitive word-boundary cross-repository [plain text search](/code-search/features#powerful-flexible-queries) for the given symbol

Search-based Code Navigation also filters results by file extension and by imports at the top of the file for some languages.

## What configuration settings can I apply?

The searcher container recognizes these environment variables:

| **Env Vars**                 | **Default**                           | **Details**                                                                                                                                                                                                      |
| ---------------------------- | ------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `CTAGS_COMMAND`              | `universal-ctags`                     | Ctags command (should point to universal-ctags executable compiled with JSON and seccomp support)                                                                                                                |
| `CTAGS_PATTERN_LENGTH_LIMIT` | `250`                                 | The maximum length of the patterns output by ctags                                                                                                                                                               |
| `LOG_CTAGS_ERRORS`           | `false`                               | Log ctags errors                                                                                                                                                                                                 |
| `SANITY_CHECK`               | `false`                               | Check that go-sqlite3 works then exit 0 if it's ok or 1 if not                                                                                                                                                   |
| `CACHE_DIR`                  | `/tmp/symbols-cache`                  | Directory in which to store cached symbols                                                                                                                                                                       |
| `SYMBOLS_CACHE_SIZE_MB`      | `100000`                              | Maximum size of the disk cache (in megabytes)                                                                                                                                                                    |
| `CTAGS_PROCESSES`            | `strconv.Itoa(runtime.GOMAXPROCS(0))` | Number of concurrent parser processes to run                                                                                                                                                                     |
| `REQUEST_BUFFER_SIZE`        | `8192`                                | Maximum size of buffered parser request channel                                                                                                                                                                  |
| `PROCESSING_TIMEOUT`         | `2 hrs`                               | Maximum time to spend processing a repository                                                                                                                                                                    |
| `MAX_TOTAL_PATHS_LENGTH`     | `100000`                              | Maximum sum of lengths of all paths in a single call to git archive                                                                                                                                              |
| `USE_ROCKSKIP`               | `false`                               | Enables [Rockskip](/code-navigation/rockskip) for fast symbol searches and search-based code navigation on repositories specified in `ROCKSKIP_REPOS`, or respositories over `ROCKSKIP_MIN_REPO_SIZE_MB` in size |
| `ROCKSKIP_REPOS`             | N/A                                   | In combination with `USE_ROCKSKIP=true` this specifies a comma-separated list of repositories to index using [Rockskip](/code-navigation/rockskip)                                                               |
| `ROCKSKIP_MIN_REPO_SIZE_MB`  | N/A                                   | In combination with `USE_ROCKSKIP=true` all repos that are at least this big will be indexed using Rockskip                                                                                                      |
| `MAX_CONCURRENTLY_INDEXING`  | 4                                     | Maximum number of repositories being indexed at a time by [Rockskip](/code-navigation/rockskip) (also limits ctags processes)                                                                                    |

The default values for these environment variables come from [`config.go`](https://github.com/sourcegraph/sourcegraph-public-snapshot/blob/eea895ae1a8acef08370a5cc6f24bdc7c66cb4ed/cmd/symbols/config.go#L42-L59).

<Callout type="tip">
	To enable precise code navigation for your repository, see our [docs
	here](/code-navigation/precise-code-navigation#setting-up-code-navigation-for-your-codebase).
</Callout>

## More resources

<LinkCards>
	<LinkCard
		href="/code-navigation/rockskip"
		imgSrc="https://storage.googleapis.com/sourcegraph-assets/Docs/sg-new-logo.svg"
		imgAlt="Rockskip"
		title="Rockskip: Symbol sidebar and search navigation"
		description="Enhances symbol sidebar and search-based code navigation experience in large monorepos."
	/>
</LinkCards>
