getCodeSearchWithHttpInfo method
Finds code in the caller org's index across three orthogonal retrieval tiers fused by reciprocal-rank fusion: lexical (FTS5 trigram over code-tokenized text), symbolic (real definition and reference edges), and semantic (embedding cosine over AST-boundary chunks).
Finds code in the caller org's index across three orthogonal retrieval tiers fused by reciprocal-rank fusion: lexical (FTS5 trigram over code-tokenized text), symbolic (real definition and reference edges), and semantic (embedding cosine over AST-boundary chunks). Pick one tier with type, or leave it to run all three as hybrid, which is what a coding agent usually wants. It is FAIL-HONEST: a retrieval outage answers 200 with an empty result set and "degraded": true rather than a 5xx, so an agent degrades instead of stalling. A malformed regex is a 400.
Note: This method returns the HTTP Response.
Parameters:
-
String q: Q is the search query. Required, max 4000 bytes. For type=regex it is a regular expression; for type=symbol it is a symbol name.
-
String type: Type selects the retrieval tier: "text" (FTS5 trigram), "regex", "symbol" (definitions), "semantic" (embeddings) or "hybrid". Anything else — including empty — reads as hybrid.
-
String repo: Repo narrows to one repository. Empty searches every repo the org has indexed.
-
int limit: Limit caps how many spans come back: default 20, maximum 100. A value that is not a positive integer reads as the default.
Implementation
Future<Response> getCodeSearchWithHttpInfo({ String? q, String? type, String? repo, int? limit, }) async {
// ignore: prefer_const_declarations
final path = r'/v1/code/search';
// ignore: prefer_final_locals
Object? postBody;
final queryParams = <QueryParam>[];
final headerParams = <String, String>{};
final formParams = <String, String>{};
if (q != null) {
queryParams.addAll(_queryParams('', 'q', q));
}
if (type != null) {
queryParams.addAll(_queryParams('', 'type', type));
}
if (repo != null) {
queryParams.addAll(_queryParams('', 'repo', repo));
}
if (limit != null) {
queryParams.addAll(_queryParams('', 'limit', limit));
}
const contentTypes = <String>[];
return apiClient.invokeAPI(
path,
'GET',
queryParams,
postBody,
headerParams,
formParams,
contentTypes.isEmpty ? null : contentTypes.first,
);
}