> ## Documentation Index
> Fetch the complete documentation index at: https://docs.corsair.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Database

> Sourcegraph local sync: searchable entities, `.search()` filters, and operators.

The Sourcegraph plugin syncs data locally. Use `corsair.sourcegraph.db.<entity>.search({ data, limit?, offset? })` with the filters listed per entity.

<Info>
  **New to Corsair?** See [database operations](/concepts/database), [data synchronization](/concepts/integrations), and [multi-tenancy](/concepts/multi-tenancy).
</Info>

## Commits

Path: `sourcegraph.db.commits.search`

```ts theme={null}
const rows = await corsair.sourcegraph.db.commits.search({
    data: { /* filters below */ },
    limit: 100,
    offset: 0,
});
```

### Searchable filters

| Field            | Type     | Operators                                  |
| ---------------- | -------- | ------------------------------------------ |
| `entity_id`      | `string` | equals, contains, startsWith, endsWith, in |
| `id`             | `string` | equals, contains, startsWith, endsWith, in |
| `oid`            | `string` | equals, contains, startsWith, endsWith, in |
| `abbreviatedOID` | `string` | equals, contains, startsWith, endsWith, in |
| `message`        | `string` | equals, contains, startsWith, endsWith, in |
| `subject`        | `string` | equals, contains, startsWith, endsWith, in |
| `url`            | `string` | equals, contains, startsWith, endsWith, in |

*Every `.search()` also accepts `limit` and `offset` for pagination. `.list()` is available on the same path without the `.search` suffix in code — see [database operations](/concepts/database).*

***

## Files

Path: `sourcegraph.db.files.search`

```ts theme={null}
const rows = await corsair.sourcegraph.db.files.search({
    data: { /* filters below */ },
    limit: 100,
    offset: 0,
});
```

### Searchable filters

| Field       | Type      | Operators                                  |
| ----------- | --------- | ------------------------------------------ |
| `entity_id` | `string`  | equals, contains, startsWith, endsWith, in |
| `id`        | `string`  | equals, contains, startsWith, endsWith, in |
| `name`      | `string`  | equals, contains, startsWith, endsWith, in |
| `path`      | `string`  | equals, contains, startsWith, endsWith, in |
| `content`   | `string`  | equals, contains, startsWith, endsWith, in |
| `binary`    | `boolean` | equals                                     |

*Every `.search()` also accepts `limit` and `offset` for pagination. `.list()` is available on the same path without the `.search` suffix in code — see [database operations](/concepts/database).*

***

## Repositories

Path: `sourcegraph.db.repositories.search`

```ts theme={null}
const rows = await corsair.sourcegraph.db.repositories.search({
    data: { /* filters below */ },
    limit: 100,
    offset: 0,
});
```

### Searchable filters

| Field         | Type     | Operators                                  |
| ------------- | -------- | ------------------------------------------ |
| `entity_id`   | `string` | equals, contains, startsWith, endsWith, in |
| `id`          | `string` | equals, contains, startsWith, endsWith, in |
| `name`        | `string` | equals, contains, startsWith, endsWith, in |
| `description` | `string` | equals, contains, startsWith, endsWith, in |
| `url`         | `string` | equals, contains, startsWith, endsWith, in |
| `language`    | `string` | equals, contains, startsWith, endsWith, in |

*Every `.search()` also accepts `limit` and `offset` for pagination. `.list()` is available on the same path without the `.search` suffix in code — see [database operations](/concepts/database).*

***

## Sites

Path: `sourcegraph.db.sites.search`

```ts theme={null}
const rows = await corsair.sourcegraph.db.sites.search({
    data: { /* filters below */ },
    limit: 100,
    offset: 0,
});
```

### Searchable filters

| Field                 | Type      | Operators                                  |
| --------------------- | --------- | ------------------------------------------ |
| `entity_id`           | `string`  | equals, contains, startsWith, endsWith, in |
| `id`                  | `string`  | equals, contains, startsWith, endsWith, in |
| `siteID`              | `string`  | equals, contains, startsWith, endsWith, in |
| `canReloadSite`       | `boolean` | equals                                     |
| `viewerCanAdminister` | `boolean` | equals                                     |

*Every `.search()` also accepts `limit` and `offset` for pagination. `.list()` is available on the same path without the `.search` suffix in code — see [database operations](/concepts/database).*

***

## Users

Path: `sourcegraph.db.users.search`

```ts theme={null}
const rows = await corsair.sourcegraph.db.users.search({
    data: { /* filters below */ },
    limit: 100,
    offset: 0,
});
```

### Searchable filters

| Field                 | Type      | Operators                                  |
| --------------------- | --------- | ------------------------------------------ |
| `entity_id`           | `string`  | equals, contains, startsWith, endsWith, in |
| `id`                  | `string`  | equals, contains, startsWith, endsWith, in |
| `username`            | `string`  | equals, contains, startsWith, endsWith, in |
| `displayName`         | `string`  | equals, contains, startsWith, endsWith, in |
| `email`               | `string`  | equals, contains, startsWith, endsWith, in |
| `siteAdmin`           | `boolean` | equals                                     |
| `viewerCanAdminister` | `boolean` | equals                                     |
| `avatarURL`           | `string`  | equals, contains, startsWith, endsWith, in |
| `url`                 | `string`  | equals, contains, startsWith, endsWith, in |
| `createdAt`           | `string`  | equals, contains, startsWith, endsWith, in |

*Every `.search()` also accepts `limit` and `offset` for pagination. `.list()` is available on the same path without the `.search` suffix in code — see [database operations](/concepts/database).*

***
