Skip to content

Commit cf8a2be

Browse files
allow list
1 parent c962fdd commit cf8a2be

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

packages/backend/src/zoekt.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Repo } from "@sourcebot/db";
2-
import { createLogger } from "@sourcebot/shared";
2+
import { createLogger, env } from "@sourcebot/shared";
33
import { exec } from "child_process";
44
import { INDEX_CACHE_DIR } from "./constants.js";
55
import { Settings } from "./types.js";
@@ -11,6 +11,8 @@ export const indexGitRepository = async (repo: Repo, settings: Settings, revisio
1111
const { path: repoPath } = getRepoPath(repo);
1212
const shardPrefix = getShardPrefix(repo.orgId, repo.id);
1313

14+
const largeFileGlobPatterns = env.ALWAYS_INDEX_FILE_PATTERNS?.split(',').map(pattern => pattern.trim()) ?? [];
15+
1416
const command = [
1517
'zoekt-git-index',
1618
'-allow_missing_branches',
@@ -21,6 +23,7 @@ export const indexGitRepository = async (repo: Repo, settings: Settings, revisio
2123
`-tenant_id ${repo.orgId}`,
2224
`-repo_id ${repo.id}`,
2325
`-shard_prefix ${shardPrefix}`,
26+
...largeFileGlobPatterns.map((pattern) => `-large_file ${pattern}`),
2427
repoPath
2528
].join(' ');
2629

packages/shared/src/env.server.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,9 @@ export const env = createEnv({
219219

220220
// Configure the default maximum number of search results to return by default.
221221
DEFAULT_MAX_MATCH_COUNT: numberSchema.default(10_000),
222+
223+
// A comma separated list of glob patterns that shwould always be indexed regardless of their size.
224+
ALWAYS_INDEX_FILE_PATTERNS: z.string().optional(),
222225
},
223226
runtimeEnv,
224227
emptyStringAsUndefined: true,

0 commit comments

Comments
 (0)