mirror of
https://github.com/sourcebot-dev/sourcebot.git
synced 2025-12-12 20:35:24 +00:00
dev README
This commit is contained in:
parent
ceee66ed46
commit
1d1205f471
1 changed files with 31 additions and 0 deletions
31
packages/web/src/features/search/README.md
Normal file
31
packages/web/src/features/search/README.md
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
# `/search`
|
||||
|
||||
Code search interface for Sourcebot.
|
||||
|
||||
## Overview
|
||||
|
||||
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.
|
||||
|
||||
## Architecture
|
||||
|
||||
**Query Flow:**
|
||||
1. User query string → Lezer parser (via `@sourcebot/query-language`)
|
||||
2. Lezer syntax tree → Query IR (Zoekt gRPC `Q` proto)
|
||||
3. Query IR → Zoekt backend → Search results
|
||||
|
||||
## Files
|
||||
|
||||
- **`index.ts`** - Public API exports for the search feature, including search functions and type definitions.
|
||||
|
||||
- **`parser.ts`** - Parses query strings into the query IR using the Lezer parser from `@sourcebot/query-language`.
|
||||
|
||||
- **`ir.ts`** - Defines the `QueryIR` type (internally the Zoekt gRPC `Q` proto) and provides utilities for traversing and querying the IR tree structure.
|
||||
|
||||
- **`types.ts`** - TypeScript types and Zod schemas for search requests, responses, file matches, stats, and streaming results.
|
||||
|
||||
- **`searchApi.ts`** - High-level search API that handles authentication, permission filtering, and orchestrates the query parsing and Zoekt backend calls.
|
||||
|
||||
- **`zoektSearcher.ts`** - Low-level interface to the Zoekt gRPC backend. Handles request construction, streaming search, response transformation, and repository metadata resolution.
|
||||
|
||||
- **`fileSourceApi.ts`** - Retrieves full file contents by executing a specialized search query against Zoekt for a specific file path.
|
||||
|
||||
Loading…
Reference in a new issue