mirror of
https://github.com/sourcebot-dev/sourcebot.git
synced 2025-12-12 12:25:22 +00:00
feat(web): Add env var to configure default max match count (#616)
This commit is contained in:
parent
a814bd6f7e
commit
2e959b7d59
5 changed files with 12 additions and 5 deletions
|
|
@ -8,7 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- Bumped the default requested search result count from 5k to 100k after optimization pass. [#615](https://github.com/sourcebot-dev/sourcebot/pull/615)
|
- Bumped the default requested search result count from 5k to 10k after optimization pass. [#615](https://github.com/sourcebot-dev/sourcebot/pull/615)
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- Fixed incorrect shutdown of PostHog SDK in the worker. [#609](https://github.com/sourcebot-dev/sourcebot/pull/609)
|
- Fixed incorrect shutdown of PostHog SDK in the worker. [#609](https://github.com/sourcebot-dev/sourcebot/pull/609)
|
||||||
|
|
@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
- Added force resync buttons for connections and repositories. [#610](https://github.com/sourcebot-dev/sourcebot/pull/610)
|
- Added force resync buttons for connections and repositories. [#610](https://github.com/sourcebot-dev/sourcebot/pull/610)
|
||||||
|
- Added environment variable to configure default search result count. [#616](https://github.com/sourcebot-dev/sourcebot/pull/616)
|
||||||
|
|
||||||
## [4.9.1] - 2025-11-07
|
## [4.9.1] - 2025-11-07
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@ The following environment variables allow you to configure your Sourcebot deploy
|
||||||
| `SOURCEBOT_STRUCTURED_LOGGING_ENABLED` | `false` | <p>Enables/disable structured JSON logging. See [this doc](/docs/configuration/structured-logging) for more info.</p> |
|
| `SOURCEBOT_STRUCTURED_LOGGING_ENABLED` | `false` | <p>Enables/disable structured JSON logging. See [this doc](/docs/configuration/structured-logging) for more info.</p> |
|
||||||
| `SOURCEBOT_STRUCTURED_LOGGING_FILE` | - | <p>Optional file to log to if structured logging is enabled</p> |
|
| `SOURCEBOT_STRUCTURED_LOGGING_FILE` | - | <p>Optional file to log to if structured logging is enabled</p> |
|
||||||
| `SOURCEBOT_TELEMETRY_DISABLED` | `false` | <p>Enables/disables telemetry collection in Sourcebot. See [this doc](/docs/overview.mdx#telemetry) for more info.</p> |
|
| `SOURCEBOT_TELEMETRY_DISABLED` | `false` | <p>Enables/disables telemetry collection in Sourcebot. See [this doc](/docs/overview.mdx#telemetry) for more info.</p> |
|
||||||
|
| `DEFAULT_MAX_MATCH_COUNT` | `10000` | <p>The default maximum number of search results to return when using search in the web app.</p> |
|
||||||
|
|
||||||
### Enterprise Environment Variables
|
### Enterprise Environment Variables
|
||||||
| Variable | Default | Description |
|
| Variable | Default | Description |
|
||||||
|
|
|
||||||
|
|
@ -216,6 +216,9 @@ export const env = createEnv({
|
||||||
SOURCEBOT_LOG_LEVEL: z.enum(["info", "debug", "warn", "error"]).default("info"),
|
SOURCEBOT_LOG_LEVEL: z.enum(["info", "debug", "warn", "error"]).default("info"),
|
||||||
SOURCEBOT_STRUCTURED_LOGGING_ENABLED: booleanSchema.default("false"),
|
SOURCEBOT_STRUCTURED_LOGGING_ENABLED: booleanSchema.default("false"),
|
||||||
SOURCEBOT_STRUCTURED_LOGGING_FILE: z.string().optional(),
|
SOURCEBOT_STRUCTURED_LOGGING_FILE: z.string().optional(),
|
||||||
|
|
||||||
|
// Configure the default maximum number of search results to return by default.
|
||||||
|
DEFAULT_MAX_MATCH_COUNT: numberSchema.default(10_000),
|
||||||
},
|
},
|
||||||
runtimeEnv,
|
runtimeEnv,
|
||||||
emptyStringAsUndefined: true,
|
emptyStringAsUndefined: true,
|
||||||
|
|
|
||||||
|
|
@ -35,14 +35,14 @@ import { FilterPanel } from "./filterPanel";
|
||||||
import { useFilteredMatches } from "./filterPanel/useFilterMatches";
|
import { useFilteredMatches } from "./filterPanel/useFilterMatches";
|
||||||
import { SearchResultsPanel } from "./searchResultsPanel";
|
import { SearchResultsPanel } from "./searchResultsPanel";
|
||||||
|
|
||||||
const DEFAULT_MAX_MATCH_COUNT = 100_000;
|
|
||||||
|
|
||||||
interface SearchResultsPageProps {
|
interface SearchResultsPageProps {
|
||||||
searchQuery: string;
|
searchQuery: string;
|
||||||
|
defaultMaxMatchCount: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const SearchResultsPage = ({
|
export const SearchResultsPage = ({
|
||||||
searchQuery,
|
searchQuery,
|
||||||
|
defaultMaxMatchCount,
|
||||||
}: SearchResultsPageProps) => {
|
}: SearchResultsPageProps) => {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { setSearchHistory } = useSearchHistory();
|
const { setSearchHistory } = useSearchHistory();
|
||||||
|
|
@ -51,8 +51,8 @@ export const SearchResultsPage = ({
|
||||||
const { toast } = useToast();
|
const { toast } = useToast();
|
||||||
|
|
||||||
// Encodes the number of matches to return in the search response.
|
// Encodes the number of matches to return in the search response.
|
||||||
const _maxMatchCount = parseInt(useNonEmptyQueryParam(SearchQueryParams.matches) ?? `${DEFAULT_MAX_MATCH_COUNT}`);
|
const _maxMatchCount = parseInt(useNonEmptyQueryParam(SearchQueryParams.matches) ?? `${defaultMaxMatchCount}`);
|
||||||
const maxMatchCount = isNaN(_maxMatchCount) ? DEFAULT_MAX_MATCH_COUNT : _maxMatchCount;
|
const maxMatchCount = isNaN(_maxMatchCount) ? defaultMaxMatchCount : _maxMatchCount;
|
||||||
|
|
||||||
const {
|
const {
|
||||||
data: searchResponse,
|
data: searchResponse,
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { env } from "@sourcebot/shared";
|
||||||
import { SearchLandingPage } from "./components/searchLandingPage";
|
import { SearchLandingPage } from "./components/searchLandingPage";
|
||||||
import { SearchResultsPage } from "./components/searchResultsPage";
|
import { SearchResultsPage } from "./components/searchResultsPage";
|
||||||
|
|
||||||
|
|
@ -18,6 +19,7 @@ export default async function SearchPage(props: SearchPageProps) {
|
||||||
return (
|
return (
|
||||||
<SearchResultsPage
|
<SearchResultsPage
|
||||||
searchQuery={query}
|
searchQuery={query}
|
||||||
|
defaultMaxMatchCount={env.DEFAULT_MAX_MATCH_COUNT}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue