Skip to content

Commit 1d1205f

Browse files
dev README
1 parent ceee66e commit 1d1205f

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# `/search`
2+
3+
Code search interface for Sourcebot.
4+
5+
## Overview
6+
7+
The search feature parses user queries into an intermediate representation (IR), which is then executed against Zoekt's gRPC search backend. Query parsing uses Lezer for syntax analysis.
8+
9+
## Architecture
10+
11+
**Query Flow:**
12+
1. User query string → Lezer parser (via `@sourcebot/query-language`)
13+
2. Lezer syntax tree → Query IR (Zoekt gRPC `Q` proto)
14+
3. Query IR → Zoekt backend → Search results
15+
16+
## Files
17+
18+
- **`index.ts`** - Public API exports for the search feature, including search functions and type definitions.
19+
20+
- **`parser.ts`** - Parses query strings into the query IR using the Lezer parser from `@sourcebot/query-language`.
21+
22+
- **`ir.ts`** - Defines the `QueryIR` type (internally the Zoekt gRPC `Q` proto) and provides utilities for traversing and querying the IR tree structure.
23+
24+
- **`types.ts`** - TypeScript types and Zod schemas for search requests, responses, file matches, stats, and streaming results.
25+
26+
- **`searchApi.ts`** - High-level search API that handles authentication, permission filtering, and orchestrates the query parsing and Zoekt backend calls.
27+
28+
- **`zoektSearcher.ts`** - Low-level interface to the Zoekt gRPC backend. Handles request construction, streaming search, response transformation, and repository metadata resolution.
29+
30+
- **`fileSourceApi.ts`** - Retrieves full file contents by executing a specialized search query against Zoekt for a specific file path.
31+

0 commit comments

Comments
 (0)