Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/cody/core-concepts/keyword-search.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@

Keyword search is the traditional approach to text search. It splits content into terms and builds a mapping from terms to documents. At query time, it extracts terms from the query and uses the mapping to retrieve your documents.

Both Cody chat and completions use Keyword Search. It comes out of the box without any additional setup. Cody with Keyword Search searches your local VS Code workspace and is a cost-effective and time-saving solution.
Both Cody chat and completions use Keyword Search. It comes out of the box without any additional setup. Cody with Keyword Search searches your [local VS Code workspace](/cody/core-concepts/local-indexing) and is a cost-effective and time-saving solution.

For an enterprise admin who has set up Cody with a Code Search instance, developers on their local machines can seamlessly access it.
114 changes: 114 additions & 0 deletions docs/cody/core-concepts/local-indexing.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
# Local Indexing

<p className="subtitle">Learn how Cody's local indexing engine works to provide fast keyword search in your workspace.</p>

Cody uses **symf** (symbol finder), a local keyword search engine, to create and maintain code indexes for your workspace folders. This enables fast context retrieval directly from your local codebase.

## How Local Indexing Works

Symf automatically creates and maintains indexes of your code:

- Starts automatically when you open a workspace and authenticate
- Runs in the background with minimal performance impact
- Detects file changes and reindexes as needed
- Persists across restarts for instant availability

## Configuration Settings

### VS Code Settings

Configure symf behavior through VS Code settings (`settings.json`):

**`cody.experimental.symf.enabled`** (default: `true`)
- Enables or disables symf functionality
- Set to `false` to completely disable local indexing

**`cody.internal.symf.path`**
- Specify a custom path to the symf binary
- When set, automatic download is skipped
- Useful for custom builds or air-gapped environments

**Manual Index Control:**

Use the Command Palette to manually trigger indexing:

- **`Cody: Update search index for current workspace folder`** - Reindex the active workspace folder
- **`Cody: Update search index for all workspace folders`** - Reindex all open workspace folders

### JetBrains Settings

Configure symf behavior in your project's custom settings file:

**Location:** `.idea/.sourcegraph/cody_settings.json`

**`cody.experimental.symf.enabled`** (default: `true`)
```json
{
"cody.experimental.symf.enabled": "true"
}
```

**Note:** JetBrains does not currently expose manual index control commands. Indexing happens automatically in the background through the Cody Agent.

### Enterprise Configuration

Administrators can use the **`symf-retrieval-disabled`** feature flag to completely disable symf for their organization. This:

- Prevents automatic binary downloads
- Disables all symf operations
- Useful for organizations with strict firewall policies
- Works for both VS Code and JetBrains clients

## Index Storage Location

Indexes are stored in your VS Code extension's global storage directory under `symf/indexroot/`. The exact location varies by operating system:

### Windows
```
%APPDATA%\Code\User\globalStorage\sourcegraph.cody-ai\symf\indexroot\
```

### macOS
```
~/Library/Application Support/Code/User/globalStorage/sourcegraph.cody-ai/symf/indexroot/
```

### Linux
```
~/.config/Code/User/globalStorage/sourcegraph.cody-ai/symf/indexroot/
```

Each workspace folder gets its own subdirectory based on its absolute path. The symf binary itself is stored in the parent `symf/` directory.

### Additional Storage Directories

- **`.tmp/`** - Temporary indexes during rebuilding
- **`.trash/`** - Deleted indexes
- **`.failed/`** - Tracks failed index attempts to prevent retry loops

## Limitations

- **Desktop only** - Only works on VS Code Desktop with local file systems (file:// URIs)
- **Not supported** on VS Code Web, remote workspaces, or virtual file systems
- **Authentication required** - Indexing only starts after you authenticate with Cody
- **Retry logic** - If indexing fails, it won't automatically retry unless you manually trigger a reindex

### Network Requirements

The symf binary is automatically downloaded from GitHub (`https://github.com/sourcegraph/symf/releases/`). Organizations with firewall restrictions should either:

1. Allow downloads from GitHub releases
2. Use the `cody.internal.symf.path` setting to point to a manually installed binary
3. Enable the `symf-retrieval-disabled` feature flag to disable symf entirely

## Troubleshooting

If you experience issues with local indexing:

1. **Check the Cody output channel** for debug logs (View → Output → Cody)
2. **Manually trigger reindexing** using the Command Palette commands
3. **Clear indexes** by deleting the storage directory and restarting VS Code
4. **Use a custom binary** if automatic downloads fail due to network restrictions
5. **Verify authentication** - Ensure you're signed in to Cody

For persistent issues, consider disabling symf with `cody.experimental.symf.enabled: false` and relying on other context retrieval methods.