Search SDK
RBS includes a powerful search engine built into every branch server. Search file contents, find files by name, and receive real-time file change notifications — all through a consistent API accessible from your editor or custom tooling.
Overview
Content search
Search for text or regex patterns across all files in your workspace. Results include line numbers, column positions, and configurable context lines.
Basic search
API: POST /api/search
Full search with all options via JSON body:
Parameters
Response
API: GET /api/search (quick search)
Search via query parameters for simple lookups:
Streaming search
For large workspaces, use the streaming endpoint to receive results in real-time via Server-Sent Events (SSE):
Results arrive as they’re found:
Fuzzy file search
Find files quickly by name using fuzzy matching — the same experience as Cmd+P / Ctrl+P in your editor.
API: GET /api/files/fuzzy
Response
An empty query returns recently modified files sorted by modification time — useful for “recent files” functionality.
How fuzzy matching works
The fuzzy matcher scores results based on:
- Character matching — all query characters must appear in order in the filename.
- Consecutive bonus — higher score for consecutive character matches.
- Word boundary bonus — higher score for matches at word boundaries (
/, _, -, ., camelCase).
- Prefix bonus — higher score for matches at the start of the filename.
- Exact match bonus — highest score for exact matches.
- Length penalty — shorter filenames score higher.
Refresh the file index
The file index refreshes automatically every 30 seconds. To force a refresh:
File watcher
Receive real-time notifications when files change in the workspace via WebSocket.
Connect
On connection, you’ll receive a confirmation message:
Event types
For rename events, an additional old_path field is included:
Debouncing
File events are debounced (100ms) to prevent rapid-fire notifications when editors auto-save, build tools generate multiple files, or external tools batch-modify files.
REST endpoints
Default ignored patterns
All search and watcher features automatically skip:
.git, .hg, .svn directories
node_modules, vendor, __pycache__
.venv, venv, .env
dist, build, target
.idea, .vscode, .rbs
- Binary files (images, executables, archives)
- Files matching
.gitignore patterns
Glob pattern examples
Editor SDK integration
If you’re building a custom editor integration, use the Search SDK client:
- Use glob filters — always specify
include_glob when you know the file type.
- Limit results — set a reasonable
max_results for UI responsiveness.
- Use streaming for large searches — the SSE endpoint returns results as they’re found.
- Debounce user input — wait 100–200ms before sending search requests when building a search UI.
- Leverage the cache — fuzzy file search results are cached and respond in milliseconds.
- Connect the watcher once — reuse a single WebSocket connection for file change events.