Skip to main content

Function: clampSearchQuery()

clampSearchQuery(query): string

Defined in: Services/Search/SearchQueryLimits.ts:37

Truncate a search query to MAX_SEARCH_QUERY_CHARS.

Embedders clamp rather than reject: by the time a query reaches an embedder the caller has committed to searching, and returning a slightly truncated result beats throwing. Callers that can reject earlier (HTTP routes) should do so instead, so the user gets a clear error rather than silently different results.

Parameters

query

string

Returns

string